b一直++,都指到 '\0' 后面去了,还可以输出?
#include <stdio.h>
void nb(char *a, char *b) {
printf("==========%p\n", b);
printf("%s\n", b);
while((*b++ = *a++) != '\0');
printf("==========%p\n", b);
printf("%s\n", b);
}
int main() {
//char nb(char *a, char *b);
char *a = "shdajsdg", b[40] = "dadsdas";
printf("%s\n\n%s\n", a, b);
nb(a, b);
// printf("%s\n",b); printf放这里可以实现打印为什么放下面的那个就不行了
return 0;
}
/*
char nb(char *a, char *b) {
while((*b++ = *a++) != '\0');
//{ ; } ???
// printf("%s\n",b); 放这里打不出来
//return ???
}
*/
|