【初心者歓迎】C/C++室 Ver.10【環境依存OK】
■ このスレッドは過去ログ倉庫に格納されています
0046デフォルトの名無しさん
NGNG#include <math.h>
struct teststruct
{
int x,y,z;
};
struct teststruct func(void);
int main()
{
struct teststruct test[8];
test=func();
printf("%d" , test[0].x);
printf("%d" , test[1].x);
printf("%d" , test[2].x);
}
struct teststruct func(void)
{
struct teststruct test[8];
test[0].x=7;
test[1].x=1;
test[2].x=3;
return test;
}
func内のtest[0]〜test[7]をそっくりそのままmainに渡したいのですけど
上のプログラムだと
error C2440: '=' : 'teststruct' から 'teststruct [8]' に変換できません。
error C2440: 'return' : 'teststruct [8]' から 'teststruct' に変換できません。
とエラーがでますどうすればいいのでしょうか?
■ このスレッドは過去ログ倉庫に格納されています