dynamic memory for 2D char array

后端 未结 6 633
别那么骄傲
别那么骄傲 2020-12-01 07:03

I have declared an array char **arr; How to initialize the memory for the 2D char array.

6条回答
  •  无人及你
    2020-12-01 07:48

    char **array;
    int row,column;
    char temp='A';
    printf("enter the row");
    scanf("%d",&row);
    printf("enter the column");
    scanf("%d",&column);
    array=(char **)malloc(row*sizeof(char *));
    for (int i=0;i

提交回复
热议问题