How do pointer to pointers work in C?

前端 未结 14 1496
渐次进展
渐次进展 2020-11-22 02:03

How do pointers to pointers work in C? When would you use them?

14条回答
  •  野的像风
    2020-11-22 02:42

    A pointer to pointer is, well, a pointer to pointer.

    A meaningfull example of someType** is a bidimensional array: you have one array, filled with pointers to other arrays, so when you write

    dpointer[5][6]

    you access at the array that contains pointers to other arrays in his 5th position, get the pointer (let fpointer his name) and then access the 6th element of the array referenced to that array (so, fpointer[6]).

提交回复
热议问题