memory allocation for array of pointers

前端 未结 4 794
梦如初夏
梦如初夏 2021-02-10 01:45

I need to allocate memory for a pointer which needs to be used as a 2d array.I know how to allocate memory for char pointers and int pointers I am confused how memory is allocat

4条回答
  •  时光说笑
    2021-02-10 02:26

    Also, in short you can do the following too in this case for allocating storage for five characters

    names = (char*)malloc(5 * sizeof(char))

提交回复
热议问题