Hello,
I met this problem to compile the code, which gave me the error message as:
kmer_SuffixArray01.c:19:28:
error: expected expression before 't_rotation'
Here is my code fragment:
//kmer_SuffixArray01.c
//Structure to store the data of a rotation
typedef struct rotation{
char* suffix;
int index;
} t_rotation;
//comparator for qsort () function
int cmpFunc(const void* x, const void* y) {
t_rotation* ptr1 = t_rotation* x; //Line 19: Must be casted???
t_rotation* ptr2 = (t_rotation*) y; //Line 20 correct way!
return strcmp(ptr1->suffix, ptr2->suffix);
}
......
I was wondering the error might be a simple problem about the syntax to cast/bracket const void pointer (const void x)* variable in C syntax.
The following Line 20 is fine which has brackets as explicit cast (?) from void to specific (t_rotation). I do not know how to specify the problem to google.
Why the bracket is needed here? Thanks a lot!