have you gotten this far yet in your investigation?
Code:
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
unsigned char value = '0';
unsigned char value2 = 0;
unsigned char value3 = '65'; // added two for good measure
unsigned char value4 = 65; // compile that to see what it tells you
// with %c and %d
printf("unsigned char value = '0' %c = %d\n",value, value );
printf("unsigned char value = 0 %c = %d\n",value2, value2 );
printf("unsigned char value = 0 %c = %d\n",value3, value3 );
printf("unsigned char value = 0 %c = %d\n",value4, value4 );
int i;
/* Print ASCII values from 0 to 255 */
for(i=0; i<=255; i++)
printf("ASCII value of character %c = %d\n", i, i);
unsigned char a = '\0';
for ( i = 0; i < 127; i++)
printf("unsigned char ASCII value of character %c = %d\n", a, a);
signed char b = '\0';
for ( i = 0; i < 127; i++)
printf("signed char ASCII value of character %c = %d\n", b, b);
char c; // another warning in this example
for ( i = 0; i < 127; i++)
printf("char ASCII value of character %c = %d\n", c, c);
// should go to 127 // ?????
unsigned char e[4] = {'1','2','3', '9'} ;
for ( i = 0; i < 4; i++)
printf("unsigned char e[4] %c = %d\n", e[i], e[i]);
unsigned char f[6] = {0, 1, 2, 3, 4, 5};
for ( i = 0; i < 6; i++)
printf("unsigned char f[6] %c = %d\n", f[i], f[i]);
return 0;
}
If you are using just zero and one then experiment with just zero and one and see what will store in the variable.
If that leads to another question. Feel free to ask.
Depending on what system you're running.
Code:
./programName > some_made_up_file_name_to_store_it_in
//to see all of the output
$ cat ascII_experiment | less
because it has a lot of output and your terminal buffer might not hold it all.