Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* A doubly linked list is different from a singly linked list in a way that each node has a extra pointer that pointes to the previous node, together with the next pointer and data similar to singly linked list */
- /* Creating a Node */
- #include <stdio.h>
- #include <stdlib.h>
- struct node {
- struct node *prev;
- int data;
- struct node *next;
- };
- int main()
- {
- struct node *head = malloc(sizeof(struct node));
- head->prev = NULL;
- head->data = 10;
- head->next = NULL;
- printf("%d", head->data);
- return 0;
- }
- /* Output: 10 */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement