| | |
wht will be the o/p?
![]() |
•
•
•
•
#include <stdio.h>
int main()
{
int i=5;
printf("%d %d %d %d %d", --i,i--,++i,--i,i);
return 0;
}
Last edited by Aia; Sep 28th, 2007 at 5:32 pm.
"If it moves, tax it. If it keeps moving, regulate it, and if it stops moving, subsidize it" - Ronald Reagan stating how a liberal's mind works.
> please reply if I am mistaken
You are mistaken.
Read the link Aia posted.
Trying to rationalise what you expect to happen, or merely posting what your current compiler gives you is no way to go.
You are mistaken.
Read the link Aia posted.
Trying to rationalise what you expect to happen, or merely posting what your current compiler gives you is no way to go.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
--
If your code lacks code tags, you will be IGNORED
--
If your code lacks code tags, you will be IGNORED
That would be a completely different program, which is fine.
Use that FAQ to also look up "sequence points". You'll see that each side effect is separated by a sequence point, so there is no issue about the order of things and your program is well defined.
But to say it always has the same output as the one-liner in the original post would be wrong.
Use that FAQ to also look up "sequence points". You'll see that each side effect is separated by a sequence point, so there is no issue about the order of things and your program is well defined.
But to say it always has the same output as the one-liner in the original post would be wrong.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
--
If your code lacks code tags, you will be IGNORED
--
If your code lacks code tags, you will be IGNORED
![]() |
Similar Threads
- Wht's the newest ver of VB.net studio (VB.NET)
- Microsoft SMS vs. novadigm software and other software (Windows Software)
- Recommended Web Hosts (Web Hosting Deals)
- Forum lurkers, introduce yourself ... !! (Community Introductions)
- win 98 (Windows 95 / 98 / Me)
- Active Directory (Windows NT / 2000 / XP)
- 98, ME, and XP have problems seeing each other (Networking Hardware Configuration)
- Windows 2000 Debug file (Windows NT / 2000 / XP)
- StorageTek Tape library upgrade (Windows NT / 2000 / XP)
Other Threads in the C Forum
- Previous Thread: Count words in a C program
- Next Thread: changing values of a struct
Views: 950 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for C
api arguments array arrays binary binarysearch c++ char character code codes coke command conversion convert copyimagefile cpu database decimal directory dude dynamic ebooks engrish error exec factorial fgets file fork function functions getlasterror givemetehcodez grade graphics hardware homework i/o input insert int integer lazy libcurl line linked linkedlist linux list lists locate logical_drives loop loops malloc matrix memory messagebox motherboard mysql no-effort opensource output path pause pointer pointers problem process program programming questions read recursion recursive recv reverse scanf single socketprograming socketprogramming spoonfeeding sql static string strings strtok structures student suggestions system systemcall turbo turbo-c turboc unix user variable windows






