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 meant by preprocessor in c?
What is "Hungarian Notation"?
What is a macro in c preprocessor?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
Explain what is a pragma?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
What are the disadvantages of external storage class?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
write a program to find the given number is prime or not
Explain the concept and use of type void.
What is difference between && and & in c?
write a program to copy the string using switch case?
Disadvantages of C language.
What is the difference between int main and void main in c?
Why is not a pointer null after calling free?