c简单的字符串操作!
#include <stdio.h>#include <string.h>
void trim(char * str1)
{
char *temp = (char *)str1;
if(temp)
{
temp++;
}
return ;
}
void main()
{
char *str = "yinlang";
printf("str = [%s]\n", str);
trim(str);
printf("str = [%s]\n", str);
}
我想要的结果是
str = [yinlang]
str = [inlang]
但是实际的结果是
str = [yinlang]
str = [yinlang]
为什么,怎么才能我要的答案呢,trim的返回值还必须是void;请高手帮忙!