I'm trying to create a bit vector set from a given array. Not sure how to start it off. For example given the array: int rows[] = {1, 2, 5} I need to make a function unsigned short MakeBitVector(int values[], int nValues) You're allowed to assume that the range for the elements in the array is 1-9. Here's what I have so far:
unsigned short MakeBitVector(int values[], int nValues)
{
(55)unsigned short int set = calloc(nValues, sizeof(unsigned short));
for(int i = 0; i < nValues; i++){
(57)set[i] = values[i];
}
return set;
}
I keep getting warnings and errors:
bits.c:55: warning: initialization makes integer from pointer without a cast
bits.c:57: error: subscripted value is neither array nor pointer
Any ideas on how to fix this?