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


Please Help Members By Posting Answers For Below Questions

What are the standard predefined macros?

630


Explain what is the difference between #include and #include 'file' ?

581


Explain what are its uses in c programming?

590


What is meant by type casting?

622


How do we declare variables in c?

561






What is || operator and how does it function in a program?

622


Write the Program to reverse a string using pointers.

613


What are pointers?

628


What are header files? What are their uses?

634


What is anagram in c?

512


what will be maximum number of comparisons when number of elements are given?

1408


Write a program for finding factorial of a number.

629


What does the c preprocessor do?

615


all c language question

1865


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

5053