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
What is d'n in c?
explain what is an endless loop?
Can we add pointers together?
How can I rethow can I return a sequence of random numbers which dont repeat at all?
What is string concatenation in c?
Explain how do you convert strings to numbers in c?
Is malloc memset faster than calloc?
What are structures and unions? State differencves between them.
Write a code to determine the total number of stops an elevator would take to serve N number of people.
What is sizeof in c?
how to print the character with maximum occurence and print that number of occurence too in a string given ?
Explain setjmp()?
What is a char in c?
I came across some code that puts a (void) cast before each call to printf. Why?
Explain a file operation in C with an example.