Skip to content
Snippets Groups Projects
Commit 9127c5dd authored by narindra.rajohnso's avatar narindra.rajohnso
Browse files

Add peek function in h and c

parent 6e8cc6fa
Branches
No related tags found
1 merge request!5Resolve "Add peek function"
#include <stdio.h>
#include "stack.h"
void peek(stack s, int *value){
if(s.top>-1 && s.top<s.capacity){
*value=s.data[s.top];
}
}
\ No newline at end of file
...@@ -7,4 +7,6 @@ typedef struct _stack { ...@@ -7,4 +7,6 @@ typedef struct _stack {
int top; int top;
} stack; } stack;
void peek(stack s, int *value);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment