MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / main

Function main

06. Sorting/Stack_using_array.cpp:53–76  ·  view source on GitHub ↗

Driver code

Source from the content-addressed store, hash-verified

51
52// Driver code
53int main()
54{
55 StackNode* root = NULL;
56
57 push(&root, 10);
58 push(&root, 20);
59 push(&root, 30);
60
61 cout << pop(&root) << " popped from stack\n";
62
63 cout << "Top element is " << peek(root) << endl;
64
65 cout<<"Elements present in stack : ";
66 //print all elements in stack :
67 while(!isEmpty(root))
68 {
69 // print top element in stack
70 cout<<peek(root)<<" ";
71 // remove top element in stack
72 pop(&root);
73 }
74
75 return 0;
76}
77
78// This is code is contributed by rathbhupendra

Callers

nothing calls this directly

Calls 4

peekFunction · 0.85
pushFunction · 0.70
popFunction · 0.70
isEmptyFunction · 0.70

Tested by

no test coverage detected