1

これが私のコードです。malloc された要素を malloc しようとしましたが、それらを解放する方法がわかりません。

char *d = "apple";
int main() {            
  char *a = malloc(10 * sizeof(char));
  char **b = &a;
  strcpy(a,d);
  printf("%c", *b[0]);
  b[0] = malloc(3 * sizeof(char));
  free(b[0]);
  free(a);
}
4

1 に答える 1