Store address dynamic array in c

Posted by user280642 on Stack Overflow See other posts from Stack Overflow or by user280642
Published on 2010-03-09T01:58:55Z Indexed on 2010/03/09 2:06 UTC
Read the original article Hit count: 193

Filed under:
|
|

I'm trying to save the address of a dynamic array index.

 struct sstor *dlist;
 struct node *q;
 q->item = &(dlist->item[(dlist->sz)-1]); // Problem?

This is my node

 struct node {
  char **item;
  struct node *next;
  struct node *prev;
 };

This is my array

 struct sstor {
  int sz;
  int maxsz;
  char item[][1024];
 };

I'm still new to pointers. The line below gives the error: assignment from incompatible pointer type

 q->item = &(dlist->item[(dlist->sz)-1]);

© Stack Overflow or respective owner

Related posts about c

    Related posts about data-structures