in Programming
1,088 views
6 votes
6 votes

The output of the following C program will be _____

#include<stdio.h>
#define type int
type foo(type b)
{
	return b*b;
}
#undef type
#define type float

int main()
{
	float a = foo(1.1);
	printf("%1.2f", a);
}
in Programming
by
1.1k views

3 Answers

6 votes
6 votes
Best answer
type will take int value .Since #undef type ; #define type float ; done after the function complete that y answer is 1.00 otherwise it will be 1.21.
selected by

4 Comments

 so what are you suggesting?

0
0
If inplace of foo(1.1),it's replaced with its definition then type should be float.right??
0
0

 ^ check my comment above, you'll get line by line execution 

0
0
0 votes
0 votes
float a=1.1// a is a floating type variable

foo(int b)=1//take value of a as a argument

so b*b=1*1=1// b is a integer type variable

return 1;

a=1 print as o/p.
0 votes
0 votes
b will take value 1 as  a argument because it is integer type

so b=1*1=1

a=1

printf(" %1.2 f",a)=1.00

so o/p will be 1.00
Answer:

Related questions