Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  xxxx
Language: C/C++
Code:
#include <stdio.h>
#include <stdint.h>

int main(int argc, char** argv) {
    union {
       uint32_t word;
       uint8_t bytes[4];
    } test_struct;
    test_struct.word = 0x1;
    if (test_struct.bytes[0] != 0)
        printf("little-endiannn");
    else
        printf("big-endiannn");
    return 0;
}
          
          
Comments: