Linked list of structures in c -


i attempting create linked list has data points structure having trouble creating node.

 typedef struct n_data{      char name[16];      int integer; } data;  typedef struct node{     data * data;     struct node *next; } node;  typedef struct{      int num;      node *head; }root; 

i have function make node returns node has data points data structure:

node *makenode(data *d){     node *temp;     temp = (node*)malloc(sizeof(node));     if(temp != null){         temp->data= d;         temp->next = null;     }     return temp; } 

and main looks this:

int main(){     data* newdata=(data*)malloc(sizeof(data));     strcpy(newdata->name,"hello");     newdata->integer=7;      node * temp;     temp = make_node(newdata); } 

i getting error

warning: assignment makes pointer integer without cast [enabled default]

i not sure doing wrong can me this?

there error in code

change line temp = make_node(newdata); temp = makenode(newdata);


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -