hi there,
i am trying to create an array of struct pointers, set each element in the array to null, and (later) then assign struct values to certain positions within the array... and i am getting confused with accessing the
elements in the array ...
if i have an array of char pointers...
Code:
char *charPtr = malloc(sizeof(char*)*5);
and go
Code:
charPtr[2] = 'b';
printf(" the char pointer is :%c: \n",charPtr[2]);
i get
Code:
the char pointer is :b:
but if i go...
Code:
typedef struct indexType
{
nodePtr head;
nodePtr tail;
int count;
} IndexType;
typedef IndexType * IndexTypePtr;
int main()
{
IndexTypePtr tester = NULL;
tester = malloc(sizeof(IndexTypePtr)*10);
tester[2] = NULL;
return 0;
}
I get an assignment type mismatch ?
Code:
assignment type mismatch:
struct indexType {pointer to struct node {..} head, pointer to struct node {..} tail,
int count} "=" int
is this because i am trying to assign null to something that has elements like head, tail
etc...
but if that is true then how does
Code:
IndexTypePtr tester = NULL;
work ??
thanks