7
votes
2answers
267 views

Which is the most correct pattern for using Stack.Pop?

There at least 2 patterns of using Stack.Pop private Stack<T> availableResources; ... if (availableResources.Count > 0) { resource = availableResources.Pop(); ... } private ...
1
vote
4answers
3k views

Is this good code? Linked List Stack Implementation

I have used the following code for a stack implementation. The top keeps track of the topmost node of the stack. Now since top is a data member of the node function, each node created will have a top ...
0
votes
2answers
53 views

Using pointers for string manipulation in c

Here I'm taking a sentence a checking if it is a palindrome or not. I'm doing this in the process of learning stacks. Is there a way I can use pointers instead of char array 'sent' so that the number ...