コンパイルエラー
Posted: 2013年12月30日(月) 15:23
配列で馬が動くプログラミングを書いたのですがエラーがでてきてしまいました。
色々試したのですがわからないので投稿いたしました。ご指南よろしくお願いいたします。
出たエラーは
23.c:26: error: incompatible type for argument 3 of ‘horse’
23.c:26: error: incompatible type for argument 4 of ‘horse’
変数を何に変えたらいいかわかりません…
色々試したのですがわからないので投稿いたしました。ご指南よろしくお願いいたします。
出たエラーは
23.c:26: error: incompatible type for argument 3 of ‘horse’
23.c:26: error: incompatible type for argument 4 of ‘horse’
変数を何に変えたらいいかわかりません…
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <eggx.h>
int win;
int horse(int i, int s, double x[i], double y[i]);///プロトタイプ言宣
int main(){
int i,s;
double x[5],y[5];
y[i] = 250.0;;
win=gopen(600,400); // 描画ウィンドウを開く
s = 0;
for (x[i]=580.0; x[i]>=10.0; x[i]--){
for (i = 0; i < 6; i++) {
gclr(win); //画面を消去
horse(i,s,x[i],y[i]);
s++;
}
}
return 0;
}
int horse(int i, int s, double x[5], double y[5]){
int size = 10.0;
int flag;
flag = 1;
if (s%10) flag*=-1;
newhsvcolor(win, 150, 200, 200); //色
fillrect(win, 0.0, 250.0, 600.0, 150.0);//背景色設定
newhsvcolor(win, 30, 200, 250); //色
fillrect(win, 0.0, 0.0, 600.0, 250.0);
/////////////
//ココから馬//
////////////
newhsvcolor(win, 10, 200, 90); //色
fillrect(win, x[i], y[i], 3.0*size, 2.5*size); //頭
fillarc(win, x[i], y[i]+size*1.3, size, size*1.2, 90.0, 270.0, 1); //口
fillrect(win, x[i]+2.0*size, y[i]-2.5*size, size, 3.0*size); //首
fillrect(win, x[i]+2.0*size, y[i]-5.5*size, 4.0*size, 3.0*size); //胴体
fillarc(win, x[i]+size*3.0, y[i]+size*4.0, size*2.0, size*2.0, 250.0, 270.0, 1); //耳
if(flag==1){
fillarc(win, x[i]+size*3.5, y[i]-8.0*size, size*2.0, size*4.0, 120.0, 140.0, 1);//前足(内)
fillarc(win, x[i]+size*4.5, y[i]-8.0*size, size*2.0, size*4.0, 45.0, 65.0, 1); //後足
}
else{
fillarc(win, x[i]+size, y[i]-8.0*size, size*2.0, size*4.0, 40.0, 60.0, 1); //前足(外)
fillarc(win, x[i]+size*7.0, y[i]-8.0*size, size*2.0, size*4.0, 120.0, 140.0, 1);//後足
}
fillarc(win, x[i]+size*6.0, y[i]-2.5*size, size*2, size*2, 300.0, 320.0, 1); //尻尾
newhsvcolor(win, 10,200,0); //色
fillcirc(win, x[i]+size*2.0, y[i]+size*1.5, size/2,size/2); //目
//////////////
//ココから人間//
//////////////
fillcirc(win, x[i]+size*4.0, y[i]+size, size,size); //頭
drawline(win, x[i]+size*4.0, y[i]+size, x[i]+size*4.0, y[i]-size*2); //胴体
drawline(win, x[i]+size*4.0, y[i], x[i]+size*3.0, y[i]); //手
drawline(win, x[i]+size*4.0, y[i]-size*2.0, x[i]+size*3.0, y[i]-size*3.5); //足
y[i]-=40.0;
msleep(50); //少し待つ
}