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