in Programming in C
598 views
0 votes
0 votes
#define value 50

main()

{

printf("%d",value);

#define value 500

printf("%d",value*10);

}



what is the output

in Programming in C
by
598 views

1 Answer

0 votes
0 votes
505000

the preprocessor should place the 'value' value i.e 50 or 500 whereever it find the 'value'.

Hence after preprocessing the program should look like

main()
{
    printf("%d",50);                            // due to define value 50
    printf("%d",500*10);                     // due to define value 500
}
 

Note : I m ignoring the fact that we have not mentioned the return type and stdio.h header file
edited by

4 Comments

it uses the value 500 giving result 5000

try compiling it
0
0
yeah rt.. I just saw 50*10 = 500 thats why !!
0
0
thanks ... have corrected it
0
0