c - 2 ways of initializing a linked list, do they equal? -


typedef struct node{     int data;     struct node* next; }listnode;  void init(listnode **head){     (*head) = (listnode *)malloc(sizeof(listnode));     (*head)->next = 0; }  listnode* another_init(){     listnode *head = (listnode *)malloc(sizeof(listnode));     return head; } 

i have problems:

1.in function init,why should put second rank pointer ?

2.is function init same another_init ?

another_init not "the same as" init. doesn't set next-pointer 0. malloc(3): malloc() allocates size bytes , returns pointer allocated memory. memory not cleared.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -