Curioustab
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
Aptitude
General Knowledge
Verbal Reasoning
Computer Science
Interview
C Preprocessor Questions
Preprocessor directive #undef can be used only on a macro that has been #define earlier
Once preprocessing is over and the program is sent for the compilation the macros are removed from the expanded source code.
Every C program will contain at least one preprocessor directive.
A header file contains macros, structure declaration and function prototypes.
In a macro call the control is passed to the macro.
A preprocessor directive is a message from compiler to a linker.
A macro must always be defined in capital letters.
Macros with arguments are allowed
Macros have a local scope.
There exists a way to prevent the same file from getting #included twice in the same program.
Will the following program print the message infinite number of times? #include<stdio.h> #define INFINITELOOP while(1) int main() { INFINITELOOP printf("CuriousTab"); return 0; }
Will the program compile successfully? #include<stdio.h> int main() { #ifdef NOTE int a; a=10; #else int a; a=20; #endif printf("%d\n", a); return 0; }
Would the following typedef work? typedef #include l;
Will the program compile successfully? #include<stdio.h> #define X (4+Y) #define Y (X+3) int main() { printf("%d\n", 4*X+2); return 0; }
It is necessary that a header files should have a .h extension?
Will the program compile successfully? #include<stdio.h> int main() { printf("India" "CURIOUSTAB\n"); return 0; }
Will it result in to an error if a header file is included twice?
1
2