Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.facebook.com/AminproPastebin
- // Linked list Example [26 Nov 2012], Lecutre
- struct Box{
- char colour[20];
- float price;
- struct Box *next;
- }
- void main(){
- struct Box *addNode(char colour[], float price);
- struct Box *Head =NULL, *Current =NULL; // Create the Head and Current pointers
- //Creating head Node
- Head=Current=addNode("",0); //Head and current is pointing to both node.
- //Start adding new node.
- Current ->next = addNode("Red", 12.5);
- Current = Current -> Next;
- //Continue adding node.
- Current -> next = addNode ("Blue", 19.9);
- Current = Current -> Next;
- //Last node.
- Current -> next = addNode("Green", 45.3);
- Current = Current -> Next;
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement