#define int_p int*
int_p p1,p2,p3; // only p1 is a pointer !
can somebody exlplain why it is so.
#define int_p int*
int_p p1,p2,p3; // only p1 is a pointer !
can somebody exlplain why it is so.
#define
is just a textual substitution. The code above is equivalent to
int *p1, p2, p3;
so only p1
is a pointer. You need
typedef int* int_p;
instead.
Rather than thinking of it like this:
int* (p1, p2, p3);
think of it like this:
int (*p1), p2, p3;
As in, only the symbol with the asterisk in-front of it becomes a pointer, not all of them.