1

このように構造体配列を関数パラメーターとして使用できることを知っています

構造体を作成する

struct number{
    int times;
    char numptr;
}numList[MAXNUM];

関数を作成します

void transform(int i, struct number *L){......}

構造体配列を関数に渡す

transform(i, numList);

しかし、VC では正常にコンパイルでき、gcc ではコンパイルに失敗するのはなぜですか? 私はコードブロックを使用し、そのコンパイラは gcc です。そのエラーの一部はここにあります

warning: 'struct number' declared inside parameter list [enabled by default]|
warning: its scope is only this definition or declaration, which is probably not what you want[enabled by default]|
warning: passing argument 2 of 'transform' from incompatible pointer type [enabled by default]|
note: expected 'struct number *' but argument is of type 'struct number *'|
error: conflicting types for 'transform'|
4

1 に答える 1