Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is operator promotion?

1070


When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?

1273


Tell us something about keyword 'auto'.

1074


Explain the term printf() and scanf() used in c language?

1051


What are all different types of pointers in c?

1012


Is null valid for pointers to functions?

1174


What is a null string in c?

1044


Subtract Two Number Without Using Subtraction Operator

852


Explain zero based addressing.

1030


typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

1199


How can I make it pause before closing the program output window?

1043


Place the #include statement must be written in the program?

1041


Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

1088


Why dont c comments nest?

1050


What are dangling pointers in c?

1234