Yes, that answers the question. Here's a more general answer:
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout<<"sizeof(char) = "<<sizeof(char)<<endl;
cout<<"sizeof(unsigned int) = "<<sizeof(unsigned int)<<endl;
//NOTE: Windows, Mac OS, and Linux and Tru64 Unix are Little Endian architectures
//Little Endian means the memory value increases as the digit significance increases
//Proof for Windows:
unsigned int x = 0x01020408; //each hexadecimal digit is 4 bits, meaning there are 2
//digits for every byte
char *c = (char *)&x;
unsigned int y = *c*pow(16,0) +pow(16,2) * *(c+1)+pow(16,4) * *(c+2)+pow(16,6) * *(c+3);
//Here's the test: construct the sum y such that we select subsequent bytes of 0x01020408
//in increasing order and then we multiply each by its corresponding significance in
//increasing order. The convention for hexadecimal number definitions is that
//the least significant digit is at the right of the number.
//Finally, if (y==x),then...
if (y==x) cout<<"Little Endian"<<endl;
else cout<<"Big Endian"<<endl;
cout<<(int) *c<<endl;
cout<<(int) *(c+1)<<endl;
cout<<(int) *(c+2)<<endl;
cout<<(int) *(c+3)<<endl;
cout<<"x is "<<x<<endl;
cout<<(int)*c<<"*1 + "<<(int)*(c+1)<<"*16^2 + "<<(int)*(c+2)<<"*16^4 + "<<(int)*(c+3)<<" *16^6 = "<<y<<endl;
system("PAUSE"); //Only include this on a counsel program
return 0;
}
This displays
8
4
2
1
for the dereferenced values at c, c+1, c+2, and c+3 respectively.
The sum y is 16909320, which is equal to x. Even though the significance of the digits grow from right-to-left, this is still Little Endian because the corresponding memory values also grow from right-to-left, which is why the left-shift binary operator << would increase a variable's value until non-zero digits are shifted off the variable altogether. Don't confuse this operator with std::cout's << operator.
If this were Big Endian, then the display for c, c+1, c+2, and c+3 respectively would look like:
1
2
4
8