c - Creating a Node for Linked List/Self Referential Structures -
i'm trying create node create linked list, i'm getting error
"intellisense: value of type "void *" cannot assigned entity of type "c"" isn't value of c synonym b: null not void? therefore shouldn't initial node created null , manipulation of linked list occur?
i haven't continued insert function because creation of node not working
#include <stdio.h> #include <stdlib.h> struct { char data; struct *nextptr; }; typedef struct b; typedef b *c; void insert(c *sptr, char value); void print(c cptr); void menu(void); int main (void) { menu(); c startptr = null; char c; int x; (x = 0; x <6; x++) { insert(&startptr, c); print(startptr); } } void menu(void) { puts("enter 1 add: \nenter 2 remove \nenter 3 quit"); } void print (c cptr) { puts("names in list"); printf("%c ->",cptr->data); } void insert(c *sptr, char value) { c nptr; c pptr; c cptr; nptr = malloc( sizeof (b)); }
Comments
Post a Comment