summaryrefslogtreecommitdiff
path: root/main/endian_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/endian_test.c')
-rw-r--r--main/endian_test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/main/endian_test.c b/main/endian_test.c
new file mode 100644
index 0000000..3e831dd
--- /dev/null
+++ b/main/endian_test.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+int main(){
+ int n = 1;
+
+// little endian if true
+ if(*(char *)&n == 1){
+ printf("little endian\n");
+ }else{
+ printf("big endian\n");
+ }
+}