C Programming - C Preprocessor

Why should I learn to solve C Programming questions and answers section on "C Preprocessor"?

Learn and practise solving C Programming questions and answers section on "C Preprocessor" to enhance your skills so that you can clear interviews, competitive examinations, and various entrance tests (CAT, GATE, GRE, MAT, bank exams, railway exams, etc.) with full confidence.

Where can I get the C Programming questions and answers section on "C Preprocessor"?

IndiaBIX provides you with numerous C Programming questions and answers based on "C Preprocessor" along with fully solved examples and detailed explanations that will be easy to understand.

Where can I get the C Programming section on "C Preprocessor" MCQ-type interview questions and answers (objective type, multiple choice)?

Here you can find multiple-choice C Programming questions and answers based on "C Preprocessor" for your placement interviews and competitive exams. Objective-type and true-or-false-type questions are given too.

How do I download the C Programming questions and answers section on "C Preprocessor" in PDF format?

You can download the C Programming quiz questions and answers section on "C Preprocessor" as PDF files or eBooks.

How do I solve C Programming quiz problems based on "C Preprocessor"?

You can easily solve C Programming quiz problems based on "C Preprocessor" by practising the given exercises, including shortcuts and tricks.

1.
What will the SWAP macro in the following program be expanded to on preprocessing? will the code compile?
#include<stdio.h>
#define SWAP(a, b, c)(c t; t=a, a=b, b=t)
int main()
{
    int x=10, y=20;
    SWAP(x, y, int);
    printf("%d %d\n", x, y);
    return 0;
}
It compiles
Compiles with an warning
Not compile
Compiles and print nothing
Answer: Option
Explanation:
The code won't compile since declaration of t cannot occur within parenthesis.

2.
In which stage the following code
#include<stdio.h>
gets replaced by the contents of the file stdio.h
During editing
During linking
During execution
During preprocessing
Answer: Option
Explanation:

The preprocessor replaces the line #include <stdio.h> with the system header file of that name. More precisely, the entire text of the file 'stdio.h' replaces the #include directive.