CoolInterview.com - World's Largest Collection of Interview Questions
Start Your Own website Now
Interview Questions
Our Services

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!



    Send your Resume to 6000 Companies


    My site is worth $108,928.
    How much is yours worth?



  • INTERVIEW QUESTIONS HARDWARE EMBEDDED SYSTEMS DETAILS
    Question :
    Who to know whether system uses big endian or little endian format and how to convert among them?
    Category Embedded Systems Interview Questions
    Rating (0.4) By 583 users
    Added on 1/24/2006
    Views 4022
    Rate it!
    Answers:

    Here is a small code segment to determine the endianess of a system at run time.

    short int number = 0x1;
    char *byte = (char*)&number;
    if ( byte[0] )
    printf("Little endian");
    else
    printf("Big endian");

    Submitted by Pooja Agrawal (poojas@gmail.com)



    unsigned int a = 0x01;
    a = a>>1;
    if(a){
    printf("little endian");
    }else{
    printf("big endian");
    }



    Posted by: Rakesh    

    Contact Rakesh Contact Rakesh

    unsigned char device_set_flag=0x01;

    if((device_set_flag >> 1) & 0x01)
    // little endian
    else
    // big endian



    Posted by: Ratnesh    

    Contact Ratnesh Contact Ratnesh

    int number = 0x01;
    if ( (number | 0xff) == 0x01 )
    printf("Little endian");
    else
    printf("Big endian");



    Posted by: Durgaprasad    

    Contact Durgaprasad Contact Durgaprasad

    If you have the better answer, then send it to us. We will display your answer after the approval.
    Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
  • Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    How is function itoa() written?
    View Answer
    Error ? what it does?
    View Answer
    Which way of writing infinite loops is more efficient than others?
    View Answer
    malloc(sizeof(0)) will return ? valid pointer
    View Answer
    a+++b -> (a++)+b
    View Answer
    Operations involving unsigned and signed ? unsigned will be converted to signed
    View Answer
    ++*ip increments what? it increments what ip points to
    View Answer
    Can you have constant volatile variable?
    View Answer
    #define cat(x,y) x##y concatenates x to y. But cat(cat(1,2),3) does not expand but gives preprocessor warning. Why?
    View Answer
    What is the output of printf(" abcd ef"); -> ef
    View Answer


    Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

    Notify me when better answer is posted!
    Email:

    View ALL Embedded Systems Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2012 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions
    Page URL: http://www.coolinterview.com/interview/4383/default.asp?cachecommand=bypass


    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | Joke of the Day

    2.48
    Cache = 0.015625 Seconds