C
comp.lang.c++
this is a sample example about this question
#include<stdio.h>
void chg(char* t)
{
char *s=t;
char p=*t;
while(*t++=*++s);
*--t=p;
}
int main()
{
//char * t="abcde";
char t[]="abcde";
chg(t);
printf(t);
printf("\n");
return 0;
}
I want know why the function chg() cann't work when define t with
char*, and what's the different
between char* and char[]?
thanks?
#include<stdio.h>
void chg(char* t)
{
char *s=t;
char p=*t;
while(*t++=*++s);
*--t=p;
}
int main()
{
//char * t="abcde";
char t[]="abcde";
chg(t);
printf(t);
printf("\n");
return 0;
}
I want know why the function chg() cann't work when define t with
char*, and what's the different
between char* and char[]?
thanks?