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 / sunil

answer is

22 21 21 20

printf .. executes from left hand side..


so first ..

printf("$d %d %d %d",k,K++,++k,k);

4.last k ie; 20
3.++k (pre) : 21
2.k++ (post) : 21 and then increamented
1.k : 22

answer is : 22 21 21 20

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a memory leak? How to avoid it?

577


Tell me about low level programming languages.

644


What is the use of header?

624


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1186


What is structure in c language?

619






How can I manipulate individual bits?

608


What are the uses of a pointer?

683


Write a code on reverse string and its complexity.

608


What are the different categories of functions in c?

646


What are the different types of objects used in c?

577


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1451


what are bit fields? What is the use of bit fields in a structure declaration?

1499


can we change the default calling convention in c if yes than how.........?

2035


How do we open a binary file in Read/Write mode in C?

680


How many loops are there in c?

582