| | |
Why the reverse output?
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Aug 2006
Posts: 2
Reputation:
Solved Threads: 0
C++ Syntax (Toggle Plain Text)
#include <iostream.h> int fred[] = { 11, 22, 33, 44 }; int *fp; int main(int argc, char *argv[]) { for (int i=0; i<argc; i++) cout << argv[i]; cout << endl << "Hello world." << endl; fp = fred; cout << *fp++ << *fp++ << *fp++ << *fp++ << " - Why is this?" << endl; fp = fred; cout << fp[0] << fp[1] << fp[2] << fp[3] << endl; fp = fred; cout << *fp++; cout << *fp++; cout << *fp++; cout << *fp++; cout << endl; fp = fred; for (i=0; i<4; i++) cout << *fp++; cout << endl; return 0; }
C++ Syntax (Toggle Plain Text)
/* output<blockquote> COUTTRY.EXEonetwothree Hello world. 44332211 - Why is this? 11223344 11223344 11223344 </blockquote>*/
Last edited by WolfPack; Aug 1st, 2006 at 1:40 pm.
> Why the reverse output?
Make sure you understand the consequences of the link posted by WaltP
Even though you might be able to come up with an explanation of why the output is reversed, there is no telling what would happen in any similar circumstance.
Undefined behaviour is very specific, anything at all can happen and the problem is solely with your code. It is not a language issue or a compiler issue.
Make sure you understand the consequences of the link posted by WaltP
Even though you might be able to come up with an explanation of why the output is reversed, there is no telling what would happen in any similar circumstance.
Undefined behaviour is very specific, anything at all can happen and the problem is solely with your code. It is not a language issue or a compiler issue.
![]() |
Similar Threads
- Reverse Output (Stack) (C++)
Other Threads in the C++ Forum
- Previous Thread: static and dynamic Dll
- Next Thread: divide
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph homeworkhelp iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg simple sorting spoonfeeding string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






