2つの整数と1つの文字列をバッファにコピーして、バッファ要素を出力しようとしています。3番目のprintfステートメントでセグメンテーション違反が発生しました。
id = 102;
len = 3;
str = "working";
memmove(buffer,&message_id,sizeof(id));
memmove(buffer+(sizeof(id)),&len,sizeof(len));
memmove(buffer+(2*sizeof(id)),&string, sizeof(str));
printf("1 is: %d\n", buffer[0]);
printf("2 is: %d\n", buffer[4]);
printf("3 is %s\n, buffer[8])); // here is where i get the seg fault should
be a string
/***/
bufer is declared as unsinged char buffer[444];
なぜこれがセグメンテーション違反になるのかわかりませんか?