c pointer test,该如何解决
c pointer testtypedef char* strvoid typetest(){str a, ba abcb cdeputs(a)puts(b)}void
c pointer test
typedef char* str;
void typetest()
{
str a, b;
a = "abc";
b = "cde";
puts(a);
puts(b);
}
void pointertest()
{
char* a, b;
a = "abc";
b = "cde";
puts(a);
puts(b);
}
typetest will be ok, pointertest will crash!
[解决办法]str a,b;
等价于
char *a,*b;
而不等价于
char *a,b;
--------------------
char *a,b;
等价于
char *a
char b;
而不等价于
char *a
char *b;