Before fixing it, change your program to this to see what you get:
Code:
int main(){
unsigned char sentence [2];
printf("1: sen[0]=%01x, sen[1]=%01x, sen[2]=%01x\n", sentence[0], sentence[1], sentence[2]) ;
sentence[0]= 'y';
sentence[1]='o';
printf("2: sen[0]=%02x, sen[1]=%02x, sen[2]=%02x\n", sentence[0], sentence[1], sentence[2]) ;
int len= strlen(sentence);
printf("%d", len);
}
You'll note that storage is not initialized, unless you specifically tell the compiler (or runtime) to initialize it.