Q:
Indicate what would the SWAP macro be expanded to on preprocessing. Would the code compile?
#define SWAP (a, b, c ) (c t; t = a, a = b, b = t; )
main()
{
int x = 10, y = 20;
SWAP (x, y, int );
printf ( " %d%d ", x, y);
}
Answer
( int t ; t = a, a = b, b = t ;);
This code won't compile since declaration of t cannot occur within parentheses.
View answer
Workspace
Report Error
Discuss