0

mallocサイズを1 バイトだけに指定しているにもかかわらず、以下のメモリがこのような大きな文字列を保持するためにどのように割り当てられるかを説明できますか

char **str;
int len = 1;
str = malloc(sizeof(char*)*len);//wont this allocate only one byte in heap?
str[0] = "This is a string";//this is more than one byte
printf("%s",str[0]);

それがどのように機能するかについてかなり混乱しています。

4

2 に答える 2