What will be the output of the following program?
#define square(x) x*x 
void main()
      int i; 
      i = 64/square(4); 
      printf("%d", i); 

A. 4

B. 64

C. 16

D. None of These

Answer: Option B

Solution(By Examveda Team)

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.

Join The Discussion

Comments ( 1 )

  1. Abdullah Ghanizada
    Abdullah Ghanizada :
    4 years ago

    square(4) = 16;
    i = 64/16 = 4;
    the answer is 4.

Related Questions on C Preprocessor

C preprocessor

A. Takes care of conditional compilation

B. Takes care of macros

C. Takes care of include files

D. Acts before compilation

E. All of the above

A preprocessor command

A. need not start on a new line

B. need not start on the first column

C. has # as the first character

D. comes before the first executable statement