0

What will be the output of following program? Assume integer is of 2 bytes......

#include<stdio.h> int main() { int a=32770; printf(“%d”,a); return 0; }

2nd Sep 2018, 12:01 PM
Aman Kumar
Aman Kumar - avatar
2 odpowiedzi
+ 2
Aman Kumar it again starts from lower value.... for example, short int has limit -32768 to 32767.... so, it will work properly within this limit... with 32768 as value, it will start with lower bound i.e. -32768 with 32769 as value , it will add one to lower bound i.e. output will be -32768 + 1 = -32767 try with other values if you wish with below code snippet in playground : short int a = 32780; printf("%i",a);
2nd Sep 2018, 12:24 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
Ketan Lalcheta thanks. I get it.....
2nd Sep 2018, 12:28 PM
Aman Kumar
Aman Kumar - avatar