C Programming - C Preprocessor

Why C Programming C Preprocessor?

In this section you can learn and practice C Programming Questions based on "C Preprocessor" and improve your skills in order to face the interview, competitive examination and various entrance test (CAT, GATE, GRE, MAT, Bank Exam, Railway Exam etc.) with full confidence.

Where can I get C Programming C Preprocessor questions and answers with explanation?

IndiaBIX provides you lots of fully solved C Programming (C Preprocessor) questions and answers with Explanation. Solved examples with detailed answer description, explanation are given and it would be easy to understand. All students, freshers can download C Programming C Preprocessor quiz questions with answers as PDF files and eBooks.

Where can I get C Programming C Preprocessor Interview Questions and Answers (objective type, multiple choice)?

Here you can find objective type C Programming C Preprocessor questions and answers for interview and entrance examination. Multiple choice and true or false type questions are also provided.

How to solve C Programming C Preprocessor problems?

You can easily solve all kind of C Programming questions based on C Preprocessor by practicing the objective type exercises given below, also get shortcut methods to solve C Programming C Preprocessor problems.

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;
}

A. It compiles
B. Compiles with an warning
C. Not compile
D. Compiles and print nothing

Answer: Option C

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

A. During editing
B. During linking
C. During execution
D. During preprocessing

Answer: Option D

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.