constness and pointers to pointers

后端 未结 4 461
时光取名叫无心
时光取名叫无心 2020-11-30 13:15

I\'m very much confused about the const keyword. I have a function accepting an array of strings as input parameter and a function accepting a variable number o

4条回答
  •  庸人自扰
    2020-11-30 14:07

    The key is that not the pointer is const. To declare a const pointer, use char *const ptr; or to declare a const pointer to a const pointer, char *const *const ptr;. const char **ptr is a pointer to pointer to const char.

提交回复
热议问题