Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://www.facebook.com/AminproPastebin
- //1. Creating the element of the list
- struct name{
- //elements
- struct name *next;
- }
- //2. Create the insert functions
- Struct name *insertnode(variables){
- struct name *temp;
- temp=(struct name *)malloc(sizeof(struct name));
- temp -> element = variable;
- temp -> next = NULL;
- return temp;
- }
- //3. Using it in main function
- struct name *head=NULL;
- struct name *curr=NULL;
- head = curr = insertnode(//Set all element to NULL for head);
- //Inserting the veriables into elements of single node.
- curr ->next = insertnode(variables);
- curr = curr ->next; // point the curr to the one you just created.
- //4. rewinding the head
- curr = head -> next;
- //5. reading the nodes(print)
- while(curr){
- printf(your elements here of curr);
- curr = curr -> next;
- }
- //FIN!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement