Welcome, %1$s. Please login or register.

December 14, 2017, 06:16:07 AM
: 1
: Code to check the endianness of a machine  ( 3970 )
« : May 12, 2007, 12:32:29 AM From Shrinidhi»



Code to check the endianness of a machine



Write a C program to determine whether a machine's byte order is big-endian or little-endian?

 
Liked It? Share it!

              


« #1 : May 18, 2007, 11:38:06 PM From Prateek»

Endianness is a very prevailing problem... I once was working on an audio streaming project where all the code seemed fine and still the audio quality was at its worst. I was debugging for weeks and finally realised that the endianess of the streaming audio that I had set and that the hardware expected were different.

The simplest way to check the endianess of a machine is by using this code snippet.


   int x = 1;
   if(*(char *)&x == 1)
      printf("Little-Endian\n");
   else
         printf("Big-Endian\n");

« #2 : May 19, 2007, 12:11:49 AM From Poonam»

Start reading the specification manual dude.
« #3 : July 08, 2007, 11:58:44 AM From priyam»

i am new into tis c language.ca u plz tell me wat is endianness of a machine?
« #4 : July 08, 2007, 08:55:39 PM From Poonam»

Hi Priyam, post a question as a new topic... and you will get the replies.
« #5 : August 09, 2007, 01:39:22 PM From eisenham»

Hi Prateek,
  can u please explain ur solution ?
: 1
« previous next »

 

Best RatedList All>>



Latest
Random



SMF 2.0.10 | SMF © 2015, Simple Machines | Contact Webmaster | OnlineFunDb.com © 2009/10 | Legal Disclaimer