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 difference between text and binary modes?

637


In C programming, what command or code can be used to determine if a number of odd or even?

618


What is the correct code to have following output in c using nested for loop?

609


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

1621


What is the use of pragma in embedded c?

585






Where in memory are my variables stored?

631


Why are algorithms important in c program?

614


Why doesnt this code work?

614


What is a stream?

642


Write a program to swap two numbers without using third variable?

812


Write a program to check armstrong number in c?

633


a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above

864


What is the explanation for prototype function in c?

564


Can you write a programmer for FACTORIAL using recursion?

606


What are the 5 organizational structures?

565