Convert from a binary to char in C

后端 未结 3 760
臣服心动
臣服心动 2020-12-16 18:37

I\'m flummoxed by how to convert from a binary value to a char in c.

For example, let\'s say I have 01010110 and want to print the corresponding letter \'V\' from t

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-16 19:29

    Did something slightly different:

    From the binary, I mathematically calculated the int and simply casted the int into a char.

    int i;
    char c = (char)i;
    

提交回复
热议问题