Making an Array to Hold Arrays of Character Arrays in C

后端 未结 5 1501
暖寄归人
暖寄归人 2021-01-17 10:04

My C is a little more than rusty at the moment, so I\'m failing to create something I think should be pretty basic.

Allow me to refer to character arrays as strings

5条回答
  •  别那么骄傲
    2021-01-17 10:31

    Note that your examples show arrays of pointers. If you want arrays of arrays (multidimensional arrays) specify all the sizes in the array definition.

    char sentences[500][42]; /* sentences is an array of 500 elements.
                             ** each element is itself an array
                             ** capable of holding strings up to length 41 */
    

提交回复
热议问题