为什么我们使用双重和三重指针在Objective-C或C语言? [英] Why we used double and triple pointer in objective-C or C language?

查看:709
本文介绍了为什么我们使用双重和三重指针在Objective-C或C语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我困惑时,我想利用单一指针和时,我应该采取双指针?
在下面的结构究竟是什么做?

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

struct objc_class {
    Class isa;
    Class super_class;
    const char *name;
    long version;
    long info;
    long instance_size;
    struct objc_ivar_list *ivars;
    struct objc_method_list **methodLists;
    struct objc_cache *cache;
    struct objc_protocol_list *protocols;
};

为什么我们使用** methodLists双指针。

Why we use the "**methodLists" double pointer.

编辑
INT sqlite3_get_table(
  sqlite3的*分贝,结果
  为const char的 ZSQL,结果
  字符*
的* pazResult,结果
  为int * pnRow,结果
  为int * pnColumn,结果
  字符*的 pzErrmsg结果
);
 在上述情况下会是怎样的三重指针的char *
的* pazResult的意义吗?

Edited int sqlite3_get_table( sqlite3 *db,
const char zSql,
char *
*pazResult,
int *pnRow,
int *pnColumn,
char *pzErrmsg
); In above scenario what will be meaning of triple pointer char *
*pazResult?

推荐答案

那么,在c。至少,双指针通常用于二维数组。最常见的二维数组可能是C字符串数组(的char * 的)。双指针有时也被用来传递函数指针引用的 的,但是这是不太可能你张贴的code样品中的使用。

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.

据名称 methodLists 我猜想,这是清单的数组。在C A(挂)列表通常重新通过指针psented到一个节点,该节点 objc_method_list 可能是$ P $。这种列表的阵列,然后用双指针实现。

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.

这篇关于为什么我们使用双重和三重指针在Objective-C或C语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆