This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bamboozled by long long


 I have the following 2 lines in a program

 unsigned long long k=1;
 unsigned int i = 4;

 printf("The values are i: %d, , k: %lX, i+k: %lX \n", i,k , i+k);
 k = k + i;
 printf("The values are i: %d, , k: %lX, i+k: %lX \n", i,k , i+k);

I get the foll. outputs:

The values are i: 4, , k: 0, i+k: 1
The values are i: 4, , k: 0, i+k: 5

Note that (i+k) is showing k's current value, yet k is always showing 
0.

Any idea please?



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]