viewing paste Unknown #1800 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
int main(int argc, char** argv)
{
    char a = 1;
    char b = a<<8; //test overflow damamge
    short c = a<<8;
 
    char db = b+10;
    short dc = c+10;
 
    char db2 = db>>1;
    char dc2 = dc>>1;
 
    db2 += 200;
    dc2 += 200;
    printf("a=%o : %d \n",a,a);
    printf("b=%o : %d dmg=%o : %d\n",b,b,db,db);
    printf("c=%o : %d dmg=%o %d %d\n",c,c,dc,dc,(char)dc);
 
    printf("dmg=%o : %d\n",db2,db2);
    printf("dmg=%o : %d\n",dc2,dc2);
    return (EXIT_SUCCESS);
}
Viewed 328 times, submitted by unknown.