lundi 28 avril 2014

function calling of a structure error


Vote count:

0




Im currently having problems trying to figure out the error of a certain part of the code that involves using a function that uses a structure of struct a and struct b



RectT a, b, recs[50];
int acount, bcount;
....

....
/* checks to see if the chk_overlap function returns a 1, if it does it adds 1 to bcount and acount */
if(chk_overlap(recs, a) == 1)
{
bcount++;
}
if(chk_overlap(recs, b) == 1)
{
acount++;
}
}


The function being called is



int chk_overlap(RectT *r1, RectT *r2){}


and the structure is



typedef struct rect
{
int x;
int y;
int w;
int h;
}RectT;


took off the code inside as this is a hmwk assignemnt


The current error is giving that im getting is


gcc -Wall -g -ansi -o xtst rec02.c


rec02.c: In function 'main':


rec02.c:64: error: incompatible type for argument 2 of 'chk_overlap'


rec02.c:69: error: incompatible type for argument 2 of 'chk_overlap'



asked 18 secs ago






Aucun commentaire:

Enregistrer un commentaire