31 lines
549 B
C
31 lines
549 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#define STACK_SIZE 10
|
|
|
|
struct stack{
|
|
float *values;
|
|
int size;
|
|
int capacity;
|
|
};
|
|
|
|
struct stack* create_stack (int capacity) {
|
|
struct stack* s = malloc (sizeof(struct stack));
|
|
if (s==NULL) {
|
|
printf("Error!");
|
|
exit(1);
|
|
}
|
|
s->values = malloc(capacity * sizeof(float));
|
|
if (s->values==NULL) {
|
|
printf("Error!");
|
|
free(s);
|
|
exit(1);
|
|
}
|
|
s->size = 0;
|
|
s->capacity = capacity;
|
|
return s;
|
|
}
|
|
|
|
int main() {
|
|
return 0;
|
|
} |