What are the differences between an array of char pointers and a 2D array?

前端 未结 4 1072
一向
一向 2021-01-06 18:38

What are the differences between an array of char pointers and a 2D array?

4条回答
  •  攒了一身酷
    2021-01-06 19:18

    char* my_string[];
    

    represents an array of strings.

    int my_grid_of_ints[][];
    char my_block_of_text[][];
    

    If color = byte[3] then you could represent your screen monitor

    color my_pixel_buffer[][] = new color[768][1024];
    

    is a 2D array. As you can see, a 2D array can represent anything, including an array of char pointers (such as multiple lines of strings).

提交回复
热议问题