No, you take an int and drop it to char, which is a high-level concept (and most likely this will be done in most registers). This has nothing to do with content, which is a concept that mainly relates to memory.
You are probably looking for:
int i = 1;
char c = *(char *) &i;
if (c) {
cout << "Little endian" << endl;
} else {
cout << "Big endian" << endl;
}
source
share