I need to declare an unsigned char array in a c program. However I am not fully aware what it takes to do that. I mean I have tried declaring char array like char abc[]; but what makes it unsigned char array? and also what does char * abc[]; would mean?
Asked
Active
Viewed 7,350 times
-3
-
`unsigned char arr[] = {100, 200};` – YOU Oct 10 '16 at 05:12
-
Googlize it before. – cagdas Oct 10 '16 at 05:14
-
Possible duplicate of [Difference between signed / unsigned char](http://stackoverflow.com/questions/4337217/difference-between-signed-unsigned-char) – Mahmoud Mubarak Oct 24 '16 at 10:20
1 Answers
0
This is an array of 10 unsigned chars:
unsigned char abc[10];
This is an array of 10 signed chars:
signed char abc[10];
If you don't explicitly say signed
or unsigned
, then it is implementation defined if this is an array of 10 signed chars or 10 unsigned chars:
char abc[10];
Note that for other types, like int
or long
, if you don't explicitly say unsigned
, they will be signed numbers.

Bill Lynch
- 80,138
- 16
- 128
- 173
-
Note that (plain) `char`, `signed char` and `unsigned char` are three different types, albeit that two cover the same range (and which two is implementation defined). – Jonathan Leffler Oct 10 '16 at 06:16