Mail Archives: djgpp/2004/07/17/08:44:54
hi john,
the problem in your program is, that you are trying to initialize the
struct list pointed at by a random pointer. the pointer list should
point to a valid structure, obtained through malloc or normal struct
list variable instantiation.
for example, struct list *plist = malloc(sizeof(struct list)), or
{struct list list; struct list *plist = &list}
best regards,
alex
φιθεθ John Hanley:
>int main()
>{
> struct data_list * list;
>
> list->head = NULL;
> list->tail = NULL;
>}
>
>When I compile then run this, I get: "Exiting due to Signal SIGSEGV. Page
>Fault at ..."
>
>Can I not assign NULL to these pointers? If I take the 2 assignments out,
>it runs ok.
>
>Any suggestions as to why I can't initialize my head and tail to NULL?
>
>Thanks!
>
>John
>
>
>
>
>
>
- Raw text -