C PROGRAMMING

Data Type Promotions

Date Published:
Last Modified:
if (-1 < (unsigned char)1)
    printf("less than");
else        
    printf("NOT less than"); 

// Prints "less than"

if (-1 < (unsigned int)1)
    printf("less than");
else        
    printf("NOT less than"); 

// Prints "not less than"!!!

Tags:

    comments powered by Disqus