Initializacia

This commit is contained in:
Anton 2024-10-08 15:45:13 +02:00
parent a1242f315f
commit 223d9acafb

View File

@ -1,5 +1,8 @@
#include<stdio.h> #include<stdio.h>
#include<stdlib.h> #include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<assert.h>
#define LINE_SIZE 100 #define LINE_SIZE 100
#define STACK_SIZE 100 #define STACK_SIZE 100
@ -17,8 +20,8 @@ void print_stack(struct stack* stack){
} }
int main(){ int main(){
char input[LINE_SIZE]; float y; char input[LINE_SIZE]; float y; struct stack mystack;
memset(&mystack, 0, sizzeof(struct stack)); memset(&mystack, 0, sizeof(struct stack));
while(fgets(input, LINE_SIZE, stdin) != NULL){ while(fgets(input, LINE_SIZE, stdin) != NULL){
input[strlen(input - 1)] = '\0'; input[strlen(input - 1)] = '\0';
@ -27,7 +30,7 @@ int main(){
assert(mystack.size < STACK_SIZE); assert(mystack.size < STACK_SIZE);
mystack.values[mystack.size] = y; mystack.values[mystack.size] = y;
mystack.size ++; mystack.size ++;
} esle{ } else{
return 1; return 1;
} }
print_stack(&mystack); print_stack(&mystack);