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 / karthikeyan
20 20 22 22
solution
1) k corresponds to 20 20
2) k++ corresponds to k = k then k+1 20
after assignment k becomes 21
3) ++k corresponds to k + 1 then k = k 22
4) k corresponds to k 22
| Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
What is const and volatile in c?
What is the difference between exit() and _exit() function?
Can a variable be both constant and volatile?
Can we compile a program without main() function?
How can I write a function analogous to scanf?
c program for searching a student details among 10 student details
Explain spaghetti programming?
provide an example of the Group by clause, when would you use this clause
Explain bitwise shift operators?
What is restrict keyword in c?
Why is c called "mother" language?
How to delete a node from linked list w/o using collectons?
What are the different data types in C?
the question is that what you have been doing all these periods (one year gap)
How can I prevent another program from modifying part of a file that I am modifying?