x86 계열에서는 little endian 으로 검출될것이고
PPC, mips 계열에서 실행하면 big endian으로 검출되겠지요.
| 코드: |
|
/* Copyright (C) Information Equipment co.,LTD. All rights reserved. Code by JaeHyuk Cho <mailto:minzkn@infoeq.com> CVSTAG="$Header$" */ #include <stdio.h> int main(void) { static const unsigned char cg_value[sizeof(int)] = {1, 0, }; if((*((int *)(&cg_value[0]))) == 1) { (void)fprintf(stdout, "little endian\n"); } else { (void)fprintf(stdout, "big endian\n"); } return(0); } /* End of source */ |

글
댓글을 달아 주세요
댓글 RSS 주소 : http://blog.minzkn.com/rss/comment/69댓글 ATOM 주소 : http://blog.minzkn.com/atom/comment/69