Sunday, May 4, 2014

Truncation of Unsigned char byte!

Note that 

#include <stdio.h>
#include <string.h>
main()
{
   unsigned char index=0xABC;
   printf("%x",index);
}

Compiling the source code....
$gcc main.c -o demo -lm -pthread -lgmp -lreadline 2>&1
main.c: In function ‘main’:
main.c:6:4: warning: large integer implicitly truncated to unsigned type [-Woverflow]
    unsigned char index=0xABC;
    ^

Executing the program....
$demo
bc 

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.