#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;
}
/* output[INDENT] COUTTRY.EXEonetwothree
Hello world.
44332211 - Why is this?
11223344
11223344
11223344
[/INDENT]*/

Thanks

> 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.

Thanks lots... I'm embarrassed, I should have known...

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.