#define INT_PTR int* typedef int*int_ptr; INT_PTR a,b; int_ptr c,d;文件中定义的四个变量,哪个变量不是指针类型?
#define INT_PTR int*typedef int*int_ptr;INT_PTR a,b;int_ptr c,d;
#define FUN(A,B) A+B
...
int tmp = FUN(2,3) * 4; // 本意是(2+3)*4,结果却变成了int tmp = 2+3*4; tmp变为14;故应改为#define FUN(A,B) (A+B)
int* p; // 合法但容易产生误导
int* p1, p2; // p1是指向int的指针,p2是int
int *p1, *p2; // p1和p2都是指向int的指针
int* p1; // p1是指向int的指针 int* p2; // p2是指向int的指针
#define CHAR_PTR char* typedef char* char_ptr; int main() { CHAR_PTR a, b; char_ptr c, d; char* e, f; cout << sizeof(a) << endl << sizeof(b) << endl << sizeof(c) << endl << sizeof(d) << endl << sizeof(e) << endl << sizeof(f) << endl; char ch2; ch2 = getchar(); } 输出414441