#ifdef something

int some=0;

#endif

main()

{

int thing = 0;

printf("%d %d\n", some ,thing);

}



#ifdef something int some=0; #endif main() { int thing ..

Answer / susie

Answer :

Compiler error : undefined symbol some

Explanation:

This is a very simple example for conditional compilation.
The name something is not already known to the compiler
making the declaration

int some = 0;

effectively removed from the source code.

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C Code Interview Questions

void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); }

1 Answers  


main() { int i=5; printf("%d",++i++); }

1 Answers  


Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector

2 Answers  


Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)

7 Answers   Microsoft,


find simple interest & compund interest

2 Answers  






x=2 y=3 z=2 x++ + y++; printf("%d%d" x,y);

2 Answers  


main() { int a[10]; printf("%d",*a+1-*a+3); }

1 Answers  


#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 Answers  


Write a program to receive an integer and find its octal equivalent?

7 Answers  


void main() { int i=5; printf("%d",i++ + ++i); }

3 Answers  


Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like.

21 Answers   ABC, eBay, Goldman Sachs, Google, HUP, Microsoft, TATA,


main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(“%d” ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(“%d ” ,*p); p++; } }

1 Answers  


Categories