I am having an error in my code below and cant figure out why. It must be some stupid smalle error. After doing a lot of testing, I have conluded that the first time through goes fine. But when it loops through a subsequent times it automatically returns 0, though the if statement is not true. Any idea what is wrong here?
edit: setCardinality returns the size of the array.
Code:int isSubset(int a[], int b[]){
int isMember(int x, int a[]);
int setCardinality(int a[]);
int i;
/*problem somewhere in here, returns 0 on loops after first*/
for(i=0;i<=setCardinality(b);i++){
if((isMember(a[i],b))==0){
return 0;
}
}
return 1;
}