Why we used double and triple pointer in objective-C or C language?

前端 未结 5 531
误落风尘
误落风尘 2021-01-14 17:14

I confused when i want to take single pointer and when should i take double pointer?
In following structure what exactly did?



        
5条回答
  •  温柔的废话
    2021-01-14 17:59

    Well, in C at least, double-pointers are commonly used for 2D arrays. The most common 2D array is probably an array of C strings (char*'s). Double pointers are also sometimes employed to pass pointers to functions by reference, but this is unlikely to be the use in the code sample you posted.

    According to the name methodLists I would guess that this is an array of lists. A (linked) list in C is commonly represented by a pointer to a node, which objc_method_list could be. An array of such lists is then implemented with a double pointer.

提交回复
热议问题