casting char[][] to char** causes segfault?

后端 未结 3 610
忘掉有多难
忘掉有多难 2020-11-29 08:54

Ok my C is a bit rusty but I figured I\'d make my next(small) project in C so I could polish back up on it and less than 20 lines in I already have a seg fault.

This

3条回答
  •  遥遥无期
    2020-11-29 09:16

    Looking at my code I realized that the amount of columns is constant, but it doesn't actually matter cause it's just a string. So I changed it so main_map is an array of strings(er, char pointers). This makes it so I can just use ** for passing it around also:

    char *main_map[ROWS]={
      "a.bb",
      "a.c.",
      "adc.",
      ".dc."};
    

提交回复
热议问题