void main()
{
int i=3;
printf("%d,%d,%d",i,i++,++i);
getch();
}
o/p:
5,4,4
if we r using ++i it will increment and it will asign to i so ans is 4
if we r using i++ it will increment but it assign to i so ans is 4
b'coz of i++ i value is 5.for clarifications execute the program
balu116 0 Newbie Poster
Narue 5,707 Bad Cop Team Colleague
ChaseVoid 30 Junior Poster
Salem 5,199 Posting Sage
ChaseVoid 30 Junior Poster
airsheys 0 Newbie Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Salem commented: thanks for finally staking this zombie to the ground! +17
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.