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 / mohamed ali

THE ANSWER IS
20 20 22 22

YOU HAVE THE 1ST 20 AS IT'S THE INITIAL VALUE

THEN YOU HAVE K++ .... HERE WE HAVE THE SAME VALUE OF K THEN
IT WILL BE INCREMENTED BY ONE .... SO YOU HAVE THE 2ND 20
AND THEN K WILL BE 21

THE THIRD YOU HAVE ++K .... WHICH MEANS THAT YOU WILL
INCREMENT THEN TYPE THE VALUE AND SINCE YOU HAVE NOW K=21
FROM PREVIOUS STEP (K++) SO THIS VALUE WILL BE INCREMENTED
BY ONE (K = 22 ) SO YOU HAVE THE THIRD VALUE 22

THEN YOU HAVE A SINGLE K WITH NO OPERATIONS SO ANOTHER 22

IF SOMEONE SEES THAT I'M WRONG PLZ CORRECT MY VIEW
THANKS

Is This Answer Correct ?    8 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

plz let me know how to become a telecom protocol tester. thank you.

2178


Explain built-in function?

1122


Can we change the value of #define in c?

983


What is a lvalue

1066


Do you know the purpose of 'register' keyword?

1011


Explain what are the different data types in c?

1202


How are variables declared in c?

1076


Can you add pointers together? Why would you?

1109


Write a program to find factorial of a number using recursive function.

1109


Does c have function or method?

981


What is non linear data structure in c?

1007


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

1138


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

2339


Why functions are used in c?

1114


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

2520