# define x=1+4;
main()
{
int x;
printf("%d%d",x/2,x/4);
}

Answers were Sorted based on User's Feedback



# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }..

Answer / karthik

the preprocessor directive is not written correctly

so u r going to get CE
#define x 1+4
void main()
{
printf("%d%d",x/2,x/4);

}
will work fine and give output as 32

Is This Answer Correct ?    4 Yes 2 No

# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }..

Answer / rama krishna sidhartha

The preprocessor syntax is wrongly written. It should be as
follows :

#define x 1+4

void main()
{
printf("%d%d",x/2,x/4);
}

There is no need of declaring the variable 'x' in
between 'main()' function since it is already declared
in '#define' directive.

The output will be : 3 and 2

Is This Answer Correct ?    2 Yes 0 No

# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }..

Answer / banavathvishnu

x/2 will become 1+4/2=3
x/4 will become 1+4/4 = 2

Is This Answer Correct ?    3 Yes 2 No

# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }..

Answer / 123ghouse@gmail.com

3,2

Is This Answer Correct ?    2 Yes 2 No

# define x=1+4; main() { int x; printf("%d%d",x/2,x/4); }..

Answer / sumalatha

ans is 4 4

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

explain memory layout of a C program

2 Answers  


Explain 'far' and 'near' pointers in c.

0 Answers  


why do some people write if(0 == x) instead of if(x == 0)?

0 Answers  


Why is c so popular?

0 Answers  


HOW DO YOU HANDLE EXCEPTIONS IN C?

2 Answers   AppLabs,






What is table lookup in c?

0 Answers  


write the program for maximum of the following numbers? 122,198,290,71,143,325,98

5 Answers  


what is the difference between entry control and exit control statement?

12 Answers   Darbari Lal DAV Model School,


What is a built-in function in C?

1 Answers  


What do you mean by recursion in c?

0 Answers  


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL

0 Answers  


What is auto keyword in c?

0 Answers  


Categories