Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
C
Could someone explain me the logic??
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
Sarath88
New Member
Join Date:
Aug 2010
Posts:
1
#1
Could someone explain me the logic??
Aug 24 '10, 02:05 PM
main()
{
int a;
int k;
a=1;
for(k=0;k<10;k+ +)
{
printf("%d %d %d\n",++a,a++,+ +a);
}
}
Output is:
3 2 2
6 5 5.....
newb16
Contributor
Join Date:
Jul 2008
Posts:
687
#2
Aug 24 '10, 02:11 PM
was asked yesterday and some more times before
Comment
Post
Cancel
Oralloy
Recognized Expert
Contributor
Join Date:
Jun 2010
Posts:
988
#3
Aug 24 '10, 06:45 PM
@Sarath88,
The program ventures into the realm of undefined behaviour. It auto-increment and/or auto-decrement of the same memory multiple times within an expression.
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment