You are not logged in.

#1 2015-04-18 05:09:04

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

Determine output:

Directions:

#include<stdio.h>
#define clrscr() 100
void main()
{
      clrscr();
      printf("%dn", clrscr());
}

Question:
Determine output:

Option A):
1
Option B):
0
Option C):
Error
Option D):
100

Correct Answer is Option D):
100

Explanation:
Preprocessor executes as a seperate pass before the execution of the compiler. So textual replacement of clrscr() to 100 occurs.The input program to compiler looks like this :

void main()
{
      100;
      printf("%d\n", 100);
}

Note: 100; is an executable statement but with no action. So it doesn't give any problem.


Failure is the first step towards seccess.

2015-04-18 05:09:04

Advertisement
Ads By Google

Re: Determine output:



\n

Board footer