Hello,
I am programming in Objective-C but I would like to write a c function to increase the performance. I have written the code below this post but the compile keeps coming back with the following error:
error: expected specific-qualifier-list before 'bool'
error: expected '=', ',', ';', 'asm' or 'attribute' before 'addToBoolArray'
structs.h:
typedef struct boolArray{
bool *array;
int count;
} boolArray;
bool addToBoolArray(boolArray *bArray, bool newBool)
structs.c:
#import "structs.h"
bool addToBoolArray(boolArray *bArray, bool newBool)
{
if(bArray->count > 0){
bArray->array = realloc(bArray->array,(bArray->count+1)*sizeof(bool));
else{
bArray->array = (bool *)malloc(sizeof(bool));
}
if(bArray->array == NULL)
return false;
bArray->array[bArray->count] = newBool;
bArray->count++;
return true;
}
I've found many forum threads about this error but none of them seem to address my issue. Any ideas?
Thank you