What is the output of the below program and how it is?

void main()
{
static int var=5;
printf("%d",var--);
if(var)
main();
}

Answer Posted / thiyagu

since the value of var is declared as static
the output will be 4 for each time printf is called by
recursive method main().

Is This Answer Correct ?    5 Yes 19 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the scope of global variable in c?

729


How to draw the flowchart for structure programs?

8950


What is the difference between single charater constant and string constant?

831


Explain how can I avoid the abort, retry, fail messages?

792


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1070






What is the use of a conditional inclusion statement in C?

806


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1729


Explain how do you sort filenames in a directory?

784


Why is c called c?

770


What is the difference between class and object in c?

794


Which header file is used for clrscr?

769


in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above

788


#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }

954


Can you please explain the difference between strcpy() and memcpy() function?

798


Explain what are preprocessor directives?

807