Lines
C, one of many ways to represent strings, consists of char arrays ending in a finite char , which is null . This is what you get by type when you have β0000β in your code.
What you want is to assign a "0000" array of unsigned char , terminated by the final unsigned char , which has a null value. Given where you start, you will have to quit or possibly present your source data in such a way as not to require casting.
unsigned char T[][] = { { 0x30, 0x30, 0x30, 0x30, 0x00 }, { 0x30, 0x30, 0x30, 0x31, 0x00 }, { 0x30, 0x30, 0x31, 0x30, 0x00 }, { 0x30, 0x30, 0x31, 0x31, 0x00 }, { 0x30, 0x31, 0x30, 0x30, 0x00 }, { 0x30, 0x31, 0x30, 0x31, 0x00 }, { 0x30, 0x31, 0x31, 0x30, 0x00 }, { 0x30, 0x31, 0x31, 0x31, 0x00 }, { 0x31, 0x30, 0x30, 0x30, 0x00 }, { 0x31, 0x30, 0x30, 0x31, 0x00 }, { 0x31, 0x30, 0x31, 0x30, 0x00 }, { 0x31, 0x30, 0x31, 0x31, 0x00 }, { 0x31, 0x31, 0x30, 0x30, 0x00 }, { 0x31, 0x31, 0x30, 0x31, 0x00 }, { 0x31, 0x31, 0x31, 0x30, 0x00 }, { 0x31, 0x31, 0x31, 0x31, 0x00 } };
The main problem that I see in this approach is that it removes most of the benefits of having a C style string in the first place. With the unsigned char string, you don't have any of the standard string libraries at your disposal, so you will need to revert back to the signed char types if you want to use printf , or any other string oriented function.
Indeed, you use only two values ββfor each possible position of the character "0" and "1". If there is no good reason for doing this in a string, consider an array of booleans to reduce the likelihood that a string, such as "0hello", will work in the code, or even better if you were entered into bit fields, use the bits inside the unsigned char as bit fields (discarding any concept with which you deal with strings).
The advantages of the latter method include the use of less memory and the inability for the value to be other than 0 or 1; however, you will need to write a small collection of routines to translate the packed bits into something human readable.
unsigned char[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; void displayChar(unsigned char value) { switch (value) { case 0x00: printf("0000"); break; case 0x01: printf("0001"); break; case 0x02: printf("0010"); break; case 0x03: printf("0011"); break; ... and so on ...