Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par himanshu mittal
Date de publication: 2013/07/03
Athanassios Staveris-Polykalas
par 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

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?