C Programming - C Preprocessor
Exercise : C Preprocessor - Yes / No Questions
6.
Will the following program print the message infinite number of times?
#include<stdio.h>
#define INFINITELOOP while(1)
int main()
{
INFINITELOOP
printf("IndiaBIX");
return 0;
}
Answer: Option
Explanation:
Yes, the program prints "IndiaBIX" and runs infinitely.
The macro INFINITELOOP while(1) replaces the text 'INFINITELOOP' by 'while(1)'
In the main function, while(1) satisfies the while condition and it prints "IndiaBIX". Then it comes to while(1) and the loop runs infinitely.
7.
Will it result in to an error if a header file is included twice?
Answer: Option
Explanation:
Unless the header file has taken care to ensure that if already included it doesn't get included again.
Turbo C, GCC compilers would take care of these problems, generate no error.
Turbo C, GCC compilers would take care of these problems, generate no error.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers