c program linked list
#include <stdio.h>
#include <stdlib.h> // <— remember this
typedef struct node {
int data; // just generic, meaninglessdata!
struct node *next;
struct ndoe *previous;
} Node;
Node* insert(Node* listHead, int dataToInsert) {
// we need to return a new head of linkedlistbecause
// the head may change after insertion
if (listHead == NULL) {
// list is emtpy, let’sinsert our first element!
printf(“inserting firstelement with data %d “,dataToInsert);
Node *newNode =malloc(sizeof(Node));
newNode->data =dataToInsert;
newNode->next =NULL;
return newNode;
} else {
// list is not empty,let’s insert at the end
printf(“insertingelement with data %d “,dataToInsert);
Node *current =listHead; // CAUTION!
while (current
PayPal Gateway not configured
PayPal Gateway not configured