Created
January 22, 2019 07:34
-
-
Save devendranaga/65f16a921006d61a81384724f5be87d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int list_add_tail(void *data) | |
{ | |
struct linked_list *t; | |
t = malloc(sizeof(struct linked_list)); | |
if (!t) { | |
return -1; | |
} | |
t->data = data; | |
if (!head) { // no head element yet.. | |
head = t; | |
tail = t; | |
} else { // add it at the tail.. | |
tail->next = t; | |
tail = t; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment