what is the output of the following program and explain the
answer
#include<stdio.h>
exp()
{
main(5)
}
main(int a)
{
printf("%d",a);
return;
}

Answers were Sorted based on User's Feedback



what is the output of the following program and explain the answer #include<stdio.h> exp() ..

Answer / yogesh bansal

if we add semicolon after main(5) like ; main(5);

the ouput will be 1.

Is This Answer Correct ?    2 Yes 2 No

what is the output of the following program and explain the answer #include<stdio.h> exp() ..

Answer / narendra vemuri

: error C2065: 'main' : undeclared identifier
: error C2143: syntax error : missing ';' before '}'
: warning C4508: 'exp' : function should return a value;
'void' return type assumed
: error C2373: 'main' : redefinition; different type modifiers
: warning C4508: 'main' : function should return a value;
'void' return type assumed
Error executing cl.exe.

test.exe - 3 error(s), 2 warning(s)

Is This Answer Correct ?    0 Yes 0 No

what is the output of the following program and explain the answer #include<stdio.h> exp() ..

Answer / vignesh1988i

first of all this will give an error tat 'exp()' is not declared or it needs a prototype & if the 'exp()' is corrected and ';' is added in calling function of main(5) this will print as 5

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More C Interview Questions

Method Overloading exist in c ?

3 Answers   Wipro,


What is the importance of c in your views?

0 Answers  


I have a varargs function which accepts a float parameter?

0 Answers  


Can a program have two main functions?

0 Answers  


Write down the program to sort the array.

4 Answers   Impiger,


Explain the difference between fopen() and freopen().

2 Answers  


write a C program, given number is double without using addt ion and multiplication operator?ex:n=6,ans=12,pls send me ans to goviseenu@gmail.com

6 Answers  


code for find determinent of amatrix

0 Answers  


write a program to print %d ?

12 Answers  


How do I create a directory? How do I remove a directory (and its contents)?

0 Answers  


Explain is it valid to address one element beyond the end of an array?

0 Answers  


What is the output of below code? main() { static in a=5; printf("%3d",a--); if(a) main(); }

4 Answers   Infosys, TCS,


Categories