-3

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?

Jane
  • 41
  • 1
  • 2
  • 4

1 Answers1

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