Preprocessors
- What will be the output of the following C code?
#include <stdio.h>
#define function(p, q) p ## q
int main()
{
printf("%s\n", function(a, b));
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Compilation Error
main.c: In function ‘main’:
main.c:5:33: error: ‘ab’ undeclared (first use in this function)
printf("%s\n", function(a, b));
^
main.c:2:28: note: in definition of macro ‘function’
#define function(p, q) p ## q
^
main.c:5:33: note: each undeclared identifier is reported only once for each function it appears in
printf("%s\n", function(a, b));
^
main.c:2:28: note: in definition of macro ‘function’
#define function(p, q) p ## q
- Which of the following names for files not accepted?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
All file names are accepted as for the execution to occur. There are no constraints on giving file names for inclusion.
- Which of the following file extensions are accepted with #include?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
The preprocessor will include whatever file extension you specify in your #include statement. However, it is not a good practice as another person debugging it will find it difficulty in finding files you have included.
- What will be the output of the following C code snippet?
#include (stdio.h)
void main()
{
printf("Welcome");
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
File to be included must be specified either in “” or <>.
- If the file name is enclosed in angle brackets, then ___________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The preprocessor treats it as a system-defined file