Preprocessors
- Comment on the output of the following C code.
#include <stdio.h>
#include "test.h"
#include "test.h"
int main()
{
//statements...
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Compilation Error
main.c:2:14: fatal error: test.h: No such file or directory
#include "test.h"
^~~~~~~~
compilation terminated.
- How is search done in #include and #include ”somelibrary.h” normally or conventionally?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
When former is used, predefined directory is searched and when latter is used, current directory is searched and then predefined directories are searched
- Can function definition be present in header files?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Yes
- How is search done in #include and #include “somelibrary.h” according to C standard?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
When former is used, search is done in implementation defined manner and when latter is used, current directory is searched.
- What will be the output of the following C code?
#include <stdio.h>
#define function(p, q) p ## q
void fun();
int main()
{
fun();
}
void fun()
{
printf("%d \n", function(10, 15));
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
1015