Ask your own question, for FREE!
Computer Science 14 Online
OpenStudy (anonymous):

void main() { unsigned giveit=-1; int gotit; printf("%u ",++giveit); printf("%u \n",gotit=--giveit); } why its output is 0 65535

OpenStudy (espex):

Because you assign giveit to a -1 and then you add 1 to it which equals 0 and then you take gotit and assign it the value of giveit -1 which loops your unsigned data value back (like rolling an odometer on a car) so it now contains the "max" short in value of 65,535.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!