What is the difference between char and unsigned char?

Dig The Code

(Edited change C/C++ to C)

Please help me to find out a clean clarification on char and unsigned char in C. Specially when we transfer data between embedded devices and general PCs (The difference between buffer of unsigned char and plain char).

Mike Seymour

You're asking about two different languages but, in this respect, the answer is (more or less) the same for both. You really should decide which language you're using though.

Differences:

  • they are distinct types
  • it's implementation-defined whether char is signed or unsigned

Similarities:

  • they are both integer types
  • they are the same size (one byte, at least 8 bits)

If you're simply using them to transfer raw byte values, with no arithmetic, then there's no practical difference.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

What is the difference between char s[] and char *s?

From Dev

What is the difference between char array[] and char *array?

From Dev

What is the difference between char array[] and char *array?

From Dev

The difference between char * and char[]

From Dev

Difference between char** and char[][]

From Java

What is an unsigned char?

From Dev

C difference between *(unsigned char *)s1 and (unsigned char)*s1

From Java

What is the difference between returning a char* and a char[] from a function?

From Dev

What is the difference between char **ptr and char *ptr[] in C?

From Dev

What's the difference between char[] & char* when declare inside struct?

From Dev

What's the difference between char[] & char* when declare inside struct?

From Dev

What is difference between char name[11]; and char *name;

From Dev

What is the difference between char stringA[LEN] and char* stringB[LEN] in C

From Dev

What is the difference between char and Character in Java?

From Dev

What is difference between hex and char array print?

From Dev

What is the difference between (char*)'r' and "r"?

From Dev

Difference between char[] and char * in C

From Dev

Difference between scanf for char * and char [ ]?

From Dev

Difference between char* and char[] (2)

From Dev

Difference between int*a and char *a?

From Dev

What is the difference between char * x,y,z;char* x,y,z;char (*)x,y,z;?

From Dev

Converting unsigned char * to char *

From Dev

Put an `unsigned char` into a `char`

From Dev

char * to array<unsigned char^>

From Dev

whats the difference for indexing of signed and unsigned char in array?

From Dev

difference between char [] and char* when doing strcpy

From Dev

Difference between new String(char[]) and char[].toString

From Dev

Difference between string literal and const char[], or char[]

From Dev

Difference between new String(char[]) and char[].toString

Related Related

  1. 1

    What is the difference between char s[] and char *s?

  2. 2

    What is the difference between char array[] and char *array?

  3. 3

    What is the difference between char array[] and char *array?

  4. 4

    The difference between char * and char[]

  5. 5

    Difference between char** and char[][]

  6. 6

    What is an unsigned char?

  7. 7

    C difference between *(unsigned char *)s1 and (unsigned char)*s1

  8. 8

    What is the difference between returning a char* and a char[] from a function?

  9. 9

    What is the difference between char **ptr and char *ptr[] in C?

  10. 10

    What's the difference between char[] & char* when declare inside struct?

  11. 11

    What's the difference between char[] & char* when declare inside struct?

  12. 12

    What is difference between char name[11]; and char *name;

  13. 13

    What is the difference between char stringA[LEN] and char* stringB[LEN] in C

  14. 14

    What is the difference between char and Character in Java?

  15. 15

    What is difference between hex and char array print?

  16. 16

    What is the difference between (char*)'r' and "r"?

  17. 17

    Difference between char[] and char * in C

  18. 18

    Difference between scanf for char * and char [ ]?

  19. 19

    Difference between char* and char[] (2)

  20. 20

    Difference between int*a and char *a?

  21. 21

    What is the difference between char * x,y,z;char* x,y,z;char (*)x,y,z;?

  22. 22

    Converting unsigned char * to char *

  23. 23

    Put an `unsigned char` into a `char`

  24. 24

    char * to array<unsigned char^>

  25. 25

    whats the difference for indexing of signed and unsigned char in array?

  26. 26

    difference between char [] and char* when doing strcpy

  27. 27

    Difference between new String(char[]) and char[].toString

  28. 28

    Difference between string literal and const char[], or char[]

  29. 29

    Difference between new String(char[]) and char[].toString

HotTag

Archive