Ask your own question, for FREE!
Computer Science 19 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 (anonymous):

An int vary between -32 768 and 32 767 whereas an unsigned int vary between 0 and 65535. So according to your code, gotit value is -1 BUT you are asking to display an unsigned value with your printf ("%u") so the program does the conversion automatically. If you want to display a negative value, you should write "%i" instead. :)

OpenStudy (anonymous):

thanks

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!