Home > Back-end >  On macro definition and pointer
On macro definition and pointer

Time:04-28


Code to achieve the function of relatively simple, is to compare a, b, c three size, main is to want to use a pointer and macro definition,
But it is an error, but I also don't understand is what problem, ask bosses look,

CodePudding user response:

I doubt that is a question of macro definition cannot use pointer, then didn't also add * in the macro definition, but it is wrong,

CodePudding user response:

Reference:
 # include 

T=# define change (a, b), (a) (a)=(b), (b)=(t
# define compare (a, b) (a) & gt; (b)? Change ((a), (b)) : NULL

Int main ()
{
Int * a * b * c, t, a, b, c;
The scanf (" % d % d % d ", & amp; A, & amp; B, & amp; C);
A=& amp; A; B=& amp; B; C=& amp; C;
Printf (" % d, % d, % d \ n ", * a, *, b * c);

Compare (* (a), (* b));
Compare (* (a), (* c));
Compare ((* b), (* c));
2: printf (" % d, % d, % d \ n ", * a, *, b * c);

return 0;
}
  • Related