You are not logged in.

#1 2015-04-18 05:03:54

hasnain
Administrator
From: Chichawatni
Registered: 2014-10-13
Posts: 8,355
Website

Output Of The Program?

Directions:

#include<stdio.h>
#define square(x) x*x 
void main()
{ 
      int i; 
      i = 64/square(4); 
      printf("%d", i); 
}

Question:
What will be the output of the following program?

Option A):
None
Option B):
4
Option C):
64
Option D):
16

Correct Answer is Option C):
64

Explanation:
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.


Failure is the first step towards seccess.

2015-04-18 05:03:54

Advertisement
Ads By Google

Re: Output Of The Program?



\n

Board footer