2

次のCコードがあります

ファイル名: abc.c

#include<stdio.h>

struct abc{
int xxx;
float yyy;
};

def.c という別のファイルで上記の構造体にアクセスする必要があります。

どうすればこれを達成できるか、誰かに説明してもらえますか?

ありがとう!

4

2 に答える 2

7
// mystructs.h
struct abc{
    int xxx;
    float yyy;
};


//abc.c
#include "mystructs.h"
struct abc var1;


//another_file.c
#include "mystructs.h"
struct abc var2;
于 2013-10-29T10:09:36.430 に答える