Which of the following is NOT a preprocessor directive in C?
What is the output of the following code?
#define MAX 5
int arr[MAX];
Which preprocessor directive is used to include standard library files?
What does the following preprocessor directive do?
#define SQUARE(x) ((x)*(x))
What is the output of this code?
#define ADD(a,b) a+b
int result = ADD(5,3)*2;
Advertisement
What is the purpose of the #ifdef directive?
Which of the following shows the correct order of preprocessor directives in a C program?
What is the difference between #include <stdio.h> and #include "myheader.h"?
What is the output?
#define MAX(a,b) (a>b?a:b)
printf("%d", MAX(10, 5));
What will happen if you define the same macro twice with different values?
What is the purpose of the #undef directive?
What is the output of this code?
#define SWAP(a,b) {int temp=a; a=b; b=temp;}
int x=5, y=10;
SWAP(x,y);
printf("%d %d", x, y);
What does the ## operator do in a macro?
What is the output?
#define STR(x) #x
printf("%s", STR(hello));
Which statement about #define is TRUE?
What is the problem with this macro?
#define DOUBLE(x) x*x
int result = DOUBLE(2+3);
What will be the output?
#define MIN(a,b) ((a)<(b)?(a):(b))
int x=5; int y=10;
int z = MIN(x++, y++);
What is the difference between #if and #ifdef?
What preprocessor features should be avoided for safer code?
What is the primary role of the C preprocessor in the compilation process?