Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Can you implement the code for a linked list data structure in C language?

user-image
Question added by himanshu mittal
Date Posted: 2013/07/03
Athanassios Staveris-Polykalas
by Athanassios Staveris-Polykalas , Secretary General of Telecommunications and Post - Hellenic Republic , General Secretariat of Telecommunications and Post - Hellenic Republic

yes, using dynamic memory allocation and pointers.
first you create a struct like: struct list_el { int value; struct list_el *next; } typedef struct list_el item; inside your main now: main () { item * curr, *head; int i; head=NULL; for (i=1;ivalue=i; curr->next=head; head=curr; } curr=head; //then you can print your list // while(curr){ printf("%d\n\t",curr->value_; curr=curr->next; } } hope this helps

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.