here is the starter code :
/*
* File: main.c
* Author: MSU
*
* Created on March 13, 2019, 1:45 PM
*/
#include <stdio.h>
#include <stdlib.h>
#define MAXSIZEI 8
#define MAXSIZEC 7
int top = -1;
int isempty(int stack[]);
int isfull(int stack[]);
int peek(int stack[]);
int pop(int stack[]);
int push(int data, int stack[]);
int printStack(int stack[]);
int size();
int main()
{
//push item on to the stack
int stack[8];
int ssize;
push(3, stack);
push(5, stack);
push(9, stack);
ssize = size();
printf(“The size of the stack is: %d\n”, ssize);
push(1, stack);
push(12, stack);
push(15, stack);
ssize = size();
printf(“The size of the stack is: %d\n”, ssize);
printf(“Element at top of the stack: %d\n”, peek(stack));
printStack(stack);
if(isfull(stack) ==1)
printf(“Stack full\n”);
else if(isempty(stack)== 1)
printf(“Stack empty\n”);
return 0;
}
int printStack(int stack[])
{
printf(“Element: \n”);
while(!isempty(stack)){
int data = pop(stack);
printf(“%d\n”, data);
}
}
int isempty(int stack[])
{
if(top == -1)
return 1;
else
return 0;
}
int isfull(int stack[])
{
if(top == MAXSIZEI)
return 1;
else
return 0;
}
int peek(int stack[])
{
return stack[top];
}
int pop(int stack[])
{
int data;
if(!isempty(stack)){
data = stack[top];
top = top – 1;
return data;
} else{
printf(“Could not retrieve data, Stack is empty”);
}
}
int push(int data, int stack[]){
if(!isfull(stack)){
top = top + 1;
stack[top] = data;
} else{
printf(“Count not insert data. Stack is full.\n”);
}
}
int size()
{
return top + 1;
}
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more