Name: Aishwary Bharat Bhati Branch: DS - B2 Roll No.: 27 Code
Name: Aishwary Bharat Bhati Branch: DS - B2 Roll No.: 27 Code
Branch : DS - B2
Roll No. : 27
Code:
#include <stdio.h>
#include <stdlib.h>
struct Node {
int data;
};
newNode->data = data;
newNode->prev = NULL;
newNode->next = NULL;
return newNode;
1
printf("Doubly linked list: ");
temp = temp->next;
printf("\n");
if (*headRef == NULL) {
*headRef = newNode;
return;
last = last->next;
last->next = newNode;
newNode->prev = last;
2
while (selectedNode != NULL) {
selectedNode = selectedNode->next;
printf("\n");
selectedNode = selectedNode->prev;
printf("\n");
int main() {
int i, value;
scanf("%d", &value);
append(&head, value);
3
}
displayList(head);
int selectedValue;
scanf("%d", &selectedValue);
currentNode = currentNode->next;
if (currentNode == NULL) {
else {
forwardPath(currentNode);
backwardPath(currentNode);
return 0;
Output 1 :
4
Output 2 :