C言語なら俺に聞け! Part 97
■ このスレッドは過去ログ倉庫に格納されています
0378デフォルトの名無しさん
NGNGextern で外部からアドレス参照できるようにするのはC言語動作的に
大丈夫なのでしょうか?
hoge.h
--------------------------
extern const int* gp_hoge;
--------------------------
hoge.cpp
--------------------------
static const int moge = 1;
int* gp_hoge = &moge;
--------------------------
main.cpp
--------------------------
#include "hoge.h"
int main()
{
printf("%d\n" , *gp_hoge );
return 0;
}
--------------------------
■ このスレッドは過去ログ倉庫に格納されています