Some annoying C programs-Part I (Frequently Asked Question MUST READ)


Here I present some C programs that, at first glance would appear to be really simple and straight forward. However, the output turns out to be quite different from what you expected(which, as we all know, is quite irritating). Read the explanation to reduce the irritation.
ALSO READ:(RECOMMENDED)



  1. main()
  2. {
      float me = 1.1;
      double you = 1.1;
      if(me==you)
       printf("I love U");
      else
       printf("I hate U");
    }

    Answer:
    I hate U
    Explanation:
    For floating point numbers (float, double, long double) the values cannot be predicted exactly. Depending on the number of bytes, the precession with of the value  represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.

    Here we are providing you the frequently asked technical C question in different placement derives.So don't forget to read this pdf/word document.
    FULL DOCUMENT IS HERE SO DOUBLE CLICK TO GET THIS PDF

DOWNLOAD PDF :   


IF BUTTON IS NOT WORKING THEN : CLICK HERE

5 comments:

  1. For ques no.-6
    Can you elaborate this line of solution- "For the second printf a+1 increases in the third dimension thus points to value at 114"
    That how it comes to 114 and not to 106??

    ReplyDelete
  2. Sorry, because still not got the logic completely.
    Here, in above comment u hv selected 102 as base address and not 100. Why??
    And if possible kindly also state the basic formula which u used.

    ReplyDelete
  3. hey ,i have updated the answer it should be 112 as base address is 100,so the next address after a+1 should be 112 as 100 + 3*2.Sorry my bad.
    If still you didn't got the logic just drop me a mail on freakyfresher@gmail.com & we can discuss it further .

    ReplyDelete
  4. Ohk!! thanks....got d logic

    ReplyDelete