File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
data_structures/linked_list Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ void push(struct node *p)
43
43
{
44
44
int item ;
45
45
struct node * temp ;
46
- temp = (struct node * )malloc (sizeof (struct node )); //creating memory for temp node.
46
+ temp = (struct node * )malloc (sizeof (struct node ));
47
47
printf ("enter element to be inserted\n" );
48
48
scanf ("%d" , & item );
49
49
temp -> info = item ;
@@ -62,21 +62,21 @@ void pop(struct node *p)
62
62
int item ;
63
63
struct node * temp ;
64
64
65
- if (top == NULL ) // Underflow condition
65
+ if (top == NULL )
66
66
printf ("stack is empty\n" );
67
67
else
68
68
{
69
69
item = top -> info ;
70
70
temp = top ;
71
- top = top -> link ; // new top will be the node pointed by previous top.
72
- free (temp ); // free the memory of node using free().
71
+ top = top -> link ;
72
+ free (temp );
73
73
printf ("Element popped is%d\n" , item );
74
74
}
75
75
}
76
76
77
77
void display (struct node * p )
78
78
{
79
- if (top == NULL ) // Underflow condition
79
+ if (top == NULL )
80
80
printf ("stack is empty\n" );
81
81
else
82
82
{
You can’t perform that action at this time.
0 commit comments