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
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
EmbLogic Research & Competency Development Labs
Phone: +91 9818467776, 8527567776, 9650467776
Email: info@emblogic.com
Copyright © EmbLogic Embedded Technologies Pvt. Ltd.
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).
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 ..