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

Is boolean a datatype in c?

761


an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational

1072


application areas a 'c' a) operating system b) graphics, interpreter, assembler c) program evalution, communication softwares d) all the above

831


What are the restrictions of a modulus operator?

849


What is the best way to comment out a section of code that contains comments?

1072


What is the collection of communication lines and routers called?

857


What is methods in c?

834


What is c language and why we use it?

804


how to introdu5ce my self in serco

1735


What is the default value of local and global variables in c?

763


What is a spanning Tree?

1239


How do I swap bytes?

834


Differentiate between Macro and ordinary definition.

984


Why is python slower than c?

811


Distinguish between actual and formal arguments.

820