
{"id":15895,"date":"2014-07-11T16:25:09","date_gmt":"2014-07-11T16:25:09","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=15895"},"modified":"2014-07-11T16:25:09","modified_gmt":"2014-07-11T16:25:09","slug":"how-to-write-a-program-to-find-endianess-of-a-machine","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2014\/07\/11\/how-to-write-a-program-to-find-endianess-of-a-machine\/","title":{"rendered":"How to write a program to find endianess of a machine ?"},"content":{"rendered":"<pre>\n#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nstatic inline int little_endian() {\nint endian = 1;\nreturn (0 == (*(char *)&amp;endian));\n}\n\nint main (int argc, char **argv)\n{\n\nprintf(\"This machine is \");\nlittle_endian() ? printf(\"little\") : printf(\"big\");\nprintf(\" endian\\n\");\n\nexit(0);\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; static inline int little_endian() { int endian = 1; return (0 == (*(char *)&amp;endian)); } int main (int argc, char **argv) { printf(&#8220;This machine is &#8220;); little_endian() ? printf(&#8220;little&#8221;) : printf(&#8220;big&#8221;); printf(&#8221; endian\\n&#8221;); exit(0); }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[141,83,91],"tags":[470,715,1063],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15895"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=15895"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15895\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=15895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=15895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=15895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}