refresh
This commit is contained in:
parent
de6f6c6ad0
commit
603a764d2d
Binary file not shown.
@ -1,34 +1,31 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
|
||||||
#define STACK_SIZE 10
|
#define STACK_SIZE 10
|
||||||
|
|
||||||
|
struct stack{
|
||||||
struct stack {
|
float *values;
|
||||||
float values[STACK_SIZE];
|
|
||||||
int size;
|
int size;
|
||||||
|
int capacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
void push_stack(struct stack* stack, float value) {
|
struct stack* create_stack (int capacity) {
|
||||||
if (stack->size >= STACK_SIZE) {
|
struct stack* s = malloc (sizeof(struct stack));
|
||||||
printf("Error!\n");
|
if (s==NULL) {
|
||||||
|
printf("Error!");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
stack->values[stack->size] = value;
|
s->values = malloc(capacity * sizeof(float));
|
||||||
stack->size++;
|
if (s->values==NULL) {
|
||||||
|
printf("Error!");
|
||||||
|
free(s);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
s->size = 0;
|
||||||
|
s->capacity = capacity;
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pop_stack(struct stack* stack) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int count_stack(struct stack* stuck) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user