What is the output of below code?
main()
{
static in a=5;
printf("%3d",a--);
if(a)
main();
}
Answer Posted / pratik panchal
output:5 4 3 2 1
static int store the value of variable for once and
periodically changes its value as the variable value changes
and a-- is done so the assigned value on the next line will
automatically overwrite the value of a.
%3d means print 5 then 2 spaces and 4 and so on..,.main is
called until if statement gets false..if(5) is a true
condition.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How can a program be made to print the name of a source file where an error occurs?
code for quick sort?
Why doesnt long int work?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
Write a program to find factorial of a number using recursive function.
Where static variables are stored in c?
What is this infamous null pointer, anyway?
What are file streams?
What is structure and union in c?
Which is better malloc or calloc?
Is null equal to 0 in sql?
What are logical errors and how does it differ from syntax errors?
Explain the difference between #include "..." And #include <...> In c?
What is type qualifiers?
What are the standard predefined macros?