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...
and goCode:char *charPtr = malloc(sizeof(char*)*5);
i getCode:charPtr[2] = 'b'; printf(" the char pointer is :%c: \n",charPtr[2]);
but if i go...Code:the char pointer is :b:
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 ?
is this because i am trying to assign null to something that has elements like head, tailCode:assignment type mismatch: struct indexType {pointer to struct node {..} head, pointer to struct node {..} tail, int count} "=" int
etc...
but if that is true then how does
work ??Code:IndexTypePtr tester = NULL;
thanks



LinkBack URL
About LinkBacks



