You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//free(temp); //free function frees the heap location pointed to by its argument, essentially, no more of that piece of heap memory now available for use
53
+
//free(temp1);
54
+
55
+
/* created a 3 ele list so far*/
56
+
/* Now, reverse it and print it too*/
57
+
58
+
//reversell (head);
59
+
60
+
/* Now, delete pth node*/
61
+
62
+
deletep(head, p);
63
+
printll (head);
64
+
65
+
insertp (head, p, newdata);
66
+
printll (head);
67
+
68
+
return0;
69
+
}
70
+
71
+
structNode*createll()
72
+
{
73
+
structNode*h=NULL;
74
+
structNode*temp=NULL;
75
+
intn=3; //for incrementing node data; first node starts with data = 3
76
+
77
+
h= (structNode*) malloc (sizeof(structNode));
78
+
h->data=n;
79
+
h->link=NULL;
80
+
81
+
temp= (structNode*) malloc (sizeof(structNode)); //allocated heap memory for second node
82
+
temp->data=++n;
83
+
temp->link=NULL;
84
+
h->link=temp;
85
+
86
+
temp= (structNode*) malloc (sizeof(structNode)); //allocated heap memory for third node
87
+
temp->data=++n;
88
+
temp->link=NULL;
89
+
(h->link)->link=temp;
90
+
91
+
temp= (structNode*) malloc (sizeof(structNode)); //allocated heap memory for fourth node
0 commit comments