You are not logged in.

#1 2015-04-18 05:01:06

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

Output Of The Program?

Directions:

#include<stdio.h>
#define int char 
void main()
{
      int i = 65;
      printf("sizeof(i)=%d", sizeof(i));
}

Question:
What will be the output of the program?

Option A):
None
Option B):
Compiler Error
Option C):
sizeof(i)=2
Option D):
sizeof(i)=1

Correct Answer is Option D):
sizeof(i)=1

Explanation:
Since the #define replaces the string int by the macro char.
So, here i is a variable of type char and not int.


Failure is the first step towards seccess.

2015-04-18 05:01:06

Advertisement
Ads By Google

Re: Output Of The Program?



\n

Board footer