WHAT WILL BE OUTPUT OF BELOW CODE . . AND PLEASE EXPLAIN HOW
IT COME ..

#include<stdio.h>
#include<conio.h>
void main()
{
int k=20;
printf("%d%d%d%d",k,k++,++k,k);
getch();
}

Answer Posted / robin

different compiler gives different ans..

this is for tc
but its true it work as stack

last in first out
value of k is store in stack
1. k = 20
2. ++k = 21 (Pre Increment )
3. k++ = 21 (Post Increment(k value now is 22))
4. k = 22

As 22 is last it is printed 1st.........

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how do you determine the length of a string value that was stored in a variable?

681


Once I have used freopen, how can I get the original stdout (or stdin) back?

640


What should malloc(0) do?

625


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

930


What is a scope resolution operator in c?

775






Can we declare variable anywhere in c?

555


Explain how can you avoid including a header more than once?

615


What is the general form of a C program?

614


GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA

1441


Why is c platform dependent?

632


Explain how do you view the path?

680


Why c is called a middle level language?

644


Can we declare a function inside a function in c?

608


Explain how can you determine the size of an allocated portion of memory?

638


What's the total generic pointer type?

626