Hello all,
how are you?
let me put a code snippet here. I used microsoft vc++ 6.0 on my windows xp machine.
/*************** *************** ****
*************** *************** *******/
Can any one please tell me what happens when we write
printf ("\n (x1-y1) = %d",(x1-y1)); ?
Does compiler create any temporary variable and assigns value of (x1-y1) to it?
if yes, this temporary variable would be signed int by default ?
if no, then why does it print (x1 - y1) > 0 ?
Thank you in advance,
Sanket
how are you?
let me put a code snippet here. I used microsoft vc++ 6.0 on my windows xp machine.
/*************** *************** ****
Code:
unsigned int x1 = 10;
unsigned int y1 = 20;
printf("\n (x1-y1) = %d",(x1-y1)); //prints -10
if((x1-y1) < 0)
printf("\n(x1 - y1) < 0");
else
printf("\n(x1 - y1) > 0"); //prints (x1 - y1) > 0
Can any one please tell me what happens when we write
printf ("\n (x1-y1) = %d",(x1-y1)); ?
Does compiler create any temporary variable and assigns value of (x1-y1) to it?
if yes, this temporary variable would be signed int by default ?
if no, then why does it print (x1 - y1) > 0 ?
Thank you in advance,
Sanket
Comment