I've read some similar questions to this but I still can't see where I'm going wrong.
I malloc the pointers and that seems to work OK, but I get an error (incompatible types) on this line:
canArray [i] = (TinCan *) malloc(sizeof(TinCan))
Here is the complete code:
typedef struct TinCan
{
int date;
int time;
} TinCan;
int main ()
{
int i;
TinCan *canArray = malloc(10 * sizeof(TinCan));
for (i =0; i < 9; i++ )
{
canArray [i] = (TinCan *) malloc(sizeof(TinCan));
}
}