7 votes 7 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); } Programming in C go-programming-1 programming programming-in-c data-types numerical-answers + – Arjun asked Oct 18, 2016 Arjun 1.7k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 6 votes 6 votes 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. Prashant. answered Oct 21, 2016 • selected Oct 21, 2016 by Arjun Prashant. comment Share Follow See all 12 Comments See all 12 12 Comments reply Show 9 previous comments Mk Utkarsh commented Sep 10, 2019 reply Follow Share MRINMOY_HALDER so what are you suggesting? 0 votes 0 votes mrinmoyh commented Sep 10, 2019 reply Follow Share If inplace of foo(1.1),it's replaced with its definition then type should be float.right?? 0 votes 0 votes Mk Utkarsh commented Sep 10, 2019 reply Follow Share MRINMOY_HALDER ^ check my comment above, you'll get line by line execution 0 votes 0 votes Please log in or register to add a comment.
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. SHIVAM GARG answered Jul 25, 2018 SHIVAM GARG comment Share Follow See all 0 reply Please log in or register to add a comment.
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 SHIVAM GARG answered Aug 17, 2018 SHIVAM GARG comment Share Follow See all 0 reply Please log in or register to add a comment.