2014年3月4日 星期二

[C language] Char convert to integer and add it


[C language] Char convert to integer and add it



#include <stdio.h>

#include <stdlib.h>



int main(void)

{

    unsigned char a,b;

    int c;

                                                                                                                                                             

    a = 0x05;

    b = 0xbf;

    c = a << 8 |  b ;

        

    printf ("The value of a is %d \n",(int)a <<  8 );

    printf ("The value of b is %d \n",(int)b );

    printf ("The value of c is %d \n",c);



    return 0;

}



 


Related Posts:

0 意見:

張貼留言