You are allocating memory to hold only one unsigned char
in
unsigned char *load = malloc(sizeof(char));
Then you are trying access the third character using load[i-1]
.
Update
The compiler error is very clear about the nature of the error
main.c:86:21: error: invalid operands to binary expression ('int' and 'unsigned char *')
temp = (load[i-1] ^ s);
Perhaps you meant to use:
temp = (load[i-1] ^ s[0]);
About the other compiler message, you can take care of that by initializing s
when it is defined.
unsigned char *s = "S";
instead of assigning to it later.