diff --git a/code.cpp b/code.cpp index 2f32a85..9c64c6f 100644 --- a/code.cpp +++ b/code.cpp @@ -6,14 +6,14 @@ int main (){ int sum=0; int n; - cin>>n; + cin >> n; int * arr = new int(n); - for(int i=0;i>arr[i]; - sum+=arr[i]; + for(int i = 0; i< n; i++){ + cin >> arr[i]; + sum += arr[i]; } - cout<next; + free(current); + } + else printf("Stack Underflow !!\n"); + +} /* Driver program to test count function*/ int main() @@ -57,5 +67,9 @@ int main() /* Check the count function */ printf("count of nodes is %d", getCount(head)); + + pop(&head); + printf("count of nodes is %d", getCount(head)); + return 0; }