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
What is operator promotion?
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?
Tell us something about keyword 'auto'.
Explain the term printf() and scanf() used in c language?
What are all different types of pointers in c?
Is null valid for pointers to functions?
What is a null string in c?
Subtract Two Number Without Using Subtraction Operator
Explain zero based addressing.
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
How can I make it pause before closing the program output window?
Place the #include statement must be written in the program?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
Why dont c comments nest?
What are dangling pointers in c?