| | |
i++ and ++i
![]() |
Not only is your example horribly broken, it's not even a valid example of the point you're trying to make.
>void main()
Implementation-defined behavior. main is required to return int.
>printf("%d,%d,%d",i,i++,++i);
Undefined behavior. The commas in an argument list do not constitute sequence points, and ++ modifies its operand.
Undefined behavior. You didn't include stdio.h, and functions that take variable arguments require a prototype in scope.
>getch();
Implementation-defined behavior. You didn't include a header that declares getch, and getch isn't a standard function.
>void main()
Implementation-defined behavior. main is required to return int.
>printf("%d,%d,%d",i,i++,++i);
Undefined behavior. The commas in an argument list do not constitute sequence points, and ++ modifies its operand.
Undefined behavior. You didn't include stdio.h, and functions that take variable arguments require a prototype in scope.
>getch();
Implementation-defined behavior. You didn't include a header that declares getch, and getch isn't a standard function.
I'm here to prove you wrong.
![]() |
Other Threads in the C Forum
- Previous Thread: Compiling Multiple files in a single Project
- Next Thread: Information on function pointers
| Thread Tools | Search this Thread |
adobe ansi api array asterisks binarysearch calculate centimeter char character convert copyanyfile copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile createprocess() csyntax directory feet fflush file floatingpointvalidation fork forloop frequency givemetehcodez global grade gtkgcurlcompiling hacking highest homework i/o inches infiniteloop interest kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate looping loopinsideloop. match meter microsoft mysql number oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance posix power probleminc process program programming pyramidusingturboccodes radix read recv recvblocked repetition research scanf scheduling segmentationfault send sequential single socket socketprograming socketprogramming stack standard string suggestions systemcall threads turboc unix urboc user variable voidmain() wab win32api windows.h






