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 are the standard predefined macros?
Explain what is the difference between #include and #include 'file' ?
Explain what are its uses in c programming?
What is meant by type casting?
How do we declare variables in c?
What is || operator and how does it function in a program?
Write the Program to reverse a string using pointers.
What are pointers?
What are header files? What are their uses?
What is anagram in c?
what will be maximum number of comparisons when number of elements are given?
Write a program for finding factorial of a number.
What does the c preprocessor do?
all c language question
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