什么是C正向参考? [英] What is forward reference in C?
本文介绍了什么是C正向参考?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是相对于指针在C正向参考?
What is forward reference in C with respect to pointers?
我能得到一个例子吗?
推荐答案
请参阅本页面<一个href=\"https://web.archive.org/web/20080314031412/http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V40F_HTML/AQTLTBTE/DOCU_024.HTM\"相对=nofollow>向前引用的。我不知道如何引用推进会有所不同的指针,并与其他POD类型。
See this page on forward references. I don't see how forward referencing would be different with pointers and with other PoD types.
请注意,您可以转发声明的类型,并声明这是指向该类型变量:
Note that you can forward declare types, and declare variables which are pointers to that type:
struct MyStruct;
struct MyStruct *ptr;
struct MyStruct var; // ILLEGAL
ptr->member; // ILLEGAL
struct MyStruct {
// ...
};
// Or:
typedef struct MyStruct MyStruct;
MyStruct *ptr;
MyStruct var; // ILLEGAL
ptr->member; // ILLEGAL
struct MyStruct {
// ...
};
我觉得这是你问的指针和前瞻性声明打交道时。
I think this is what you're asking for when dealing with pointers and forward declaration.
这篇关于什么是C正向参考?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文