Why does the following program not print an s
character?:
#include <stdlib.h>
#include <stdio.h>
int main(void) {
unsigned char s = '\0';
unsigned int bits[8] = {0, 1, 1, 1, 0, 0, 1, 1};
for (int i = 0; i < 8; i++) {
s ^= bits[i] << i;
}
printf("%c\n", s);
return 0;
}
So I am basically trying to create the s
character from a list of bits.
Why do I get some other weird character from this program?