ExamVeda
Login
Home
This question belongs to C Program C Preprocessor
C Preprocessor
?

What will be the output of the following program?
#include<stdio.h>
#define square(x) x*x 
void main()
{ 
      int i; 
      i = 64/square(4); 
      printf("%d", i); 
}

Answer & Solution
Correct Answer: Option B

The macro call square(4) will be substituted by 4*4 so the expression becomes i = 64/4*4 . Since / and * has equal priority and associativity left to right, so the expression will be evaluated as (64/4)*4 i.e. 16*4 = 64.

Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Abdullah Ghanizada
Abdullah Ghanizada 9 years ago
square(4) = 16;
therefore,
i = 64/16 = 4;
the answer is 4.