gcc 4.4.4 c89
これはヘッダーファイルにあります。
port.h
struct struct_tag;
int initialize_ports(struct_tag *port);
私の実装ファイルにはこれがあります:
port.c
typedef struct struct_tag {
int port_id;
} Port_t;
そして、私のdriver.hファイルには、次のものがあります。
#include "port.h"
int initialize_ports(struct_tag *port)
{
port = malloc(sizeof *port);
/* do checking here */
}
内部要素を非表示にしたいので、構造を前方宣言しました。
ただし、ヘッダーファイルのinitialize_portsで次のエラーが発生します。
expected ‘)’ before ‘*’ token
構造体をパラメーターとして前方宣言して渡すことができるようにするにはどうすればよいのでしょうか。
アドバイスをありがとう、