Bytewise reading of memory: “signed char *” vs “unsigned char *”

前端 未结 5 1472
一个人的身影
一个人的身影 2020-12-05 08:14

One often needs to read from memory one byte at a time, like in this naive memcpy() implementation:

void *memcpy(void *dest, const void *src, si         


        
5条回答
  •  没有蜡笔的小新
    2020-12-05 08:46

    In your code example it makes no difference. But if you want to display/print the value of the byte than it does (as the highest bit is interpreted differently), and unsigned char seems more suitable

提交回复
热议问题