Showing posts with label Pre-Processor. Show all posts
Showing posts with label Pre-Processor. Show all posts

Monday, February 15, 2010

C Preprocessor Question

#define PRINT printout

int main()
{
printf("PRINT");
}

Choice:
a)error
b)PRINT
c)printout
d)no output

Monday, February 8, 2010

What is the output of following programme ?

# include
# define a 10
main()
{
printf("%d..",a);
foo();
printf("%d",a);
}
void foo()
{
#undef a
#define a 50
}

a) 10..10
b) 10..50
c) Error
d) 0

Thursday, January 29, 2009

You have the following line in a C program:

#include
and you compile the program.
Given the scenario described above, how is the line parsed?

Choice a : The linker resolves the symbols in stdio.h and links it with the overall program.

Choice b : The preprocessor creates pointers to stdio.h.

Choice c : The compiler creates lexically local variables definitions stored in stdio.h.

Choice d : The compiler allocates a name space for the symbols stored in stdio.h.

Choice e : The preprocessor replaces the line with the contents of stdio.h.