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
Can we change the value of static variable in c?
What is #error and use of it?
What is c value paradox explain?
How are 16- and 32-bit numbers stored?
What is the difference between array and pointer in c?
What is define c?
What is #include conio h?
What is the use of a conditional inclusion statement in C?
What is pre-emptive data structure and explain it with example?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
Explain how are portions of a program disabled in demo versions?
Why double pointer is used in c?
Between macros and functions,which is better to use and why?
What is structure padding and packing in c?
Why c is procedure oriented?