EmbLogic's Blog

query regarding Assignment1 question 13

printf(“%d%d%d\n”,i,i+1,i+2);

Why the output is in -ve  for i+1 and  i+2?
2147483647 – 2147483648 -2147483647

2 Responses to query regarding Assignment1 question 13

  1. Hemkaran says:

    coz 2147483647(2^32 -1) is the maximum value of a integer can accept. If u increament by 1 then it will round to starting value which is -2147483648(2^32).

  2. hemant.kumar says:

    range of signed integer is from -2147483648 to+2147483647….and for unsigned integer(+ve values)0 to 4294967295U..
    when you increement it by 1 it goes back to the first value and so on.. but in case of unsigned integer if you add 1 to the maximum value it gives ZERO and it is represented by %u ..

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>