Language: C

/*
    ex9_1
    takaoga
 */
#include<stdio.h>
#include<stdlib.h>
#define SIZE 10
typedef struct{
    int size;
    int count;
    char data[SIZE];
    char *top;
} stack;

void initialize_text(stack *text){
    text->count = 0;
    text->size = SIZE;
    text->top = &(text->data[SIZE]);
}

void push(stack *text, char textcharacter){
    if(text->count >= text->size){
        printf("Error: stack overflow. (x=%lf)¥n", x);
        exit(1);
    }else{
        text->top--;
        *(text->top) = textcharacter;
        text->count++;
    }
}

void pop(stack *text){
    if(text->count <= 0){
        printf("Error: stack overflow. (x=%lf)¥n", x);
        exit(1);
    }else{
        text->top++;
        text->count--;
    }
}

void print_text(stack *text){
    char *texttop;
    texttop = text->top;
    for(int i = 0 ; i < text->count ; i++){
        printf("%c", *texttop++);
    }
    printf("\n");
}

stack text;

int main(void){
    char inputtext[10],nowtext;
    initialize_stack(&text);
    scanf("%s",inputtext);
    nowtext = &inputtext[0];
    while(*nowtext!=NULL){
        if(*nowtext == '0' || *nowtext == '1'){
            push(&text, *nowtext);
        }else if(*nowtext == 'B'){
            if(*(nowtext-1) != NULL){
                pop(&text);
            }
        }
    }
    print_text(&text);
    return 0;
}



Compiler output:
main.c: In function 'push':
main.c:23:52: error: 'x' undeclared (first use in this function)
   23 |         printf("Error: stack overflow. (x=%lf)¥n", x);
      |                                                    ^
main.c:23:52: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'pop':
main.c:34:52: error: 'x' undeclared (first use in this function)
   34 |         printf("Error: stack overflow. (x=%lf)¥n", x);
      |                                                    ^
main.c: In function 'main':
main.c:55:5: error: implicit declaration of function 'initialize_stack'; did you mean 'initialize_text'? [-Wimplicit-function-declaration]
   55 |     initialize_stack(&text);
      |     ^~~~~~~~~~~~~~~~
      |     initialize_text
main.c:57:13: error: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
   57 |     nowtext = &inputtext[0];
      |             ^
main.c:58:11: error: invalid type argument of unary '*' (have 'int')
   58 |     while(*nowtext!=NULL){
      |           ^~~~~~~~
main.c:59:12: error: invalid type argument of unary '*' (have 'int')
   59 |         if(*nowtext == '0' || *nowtext == '1'){
      |            ^~~~~~~~
main.c:59:31: error: invalid type argument of unary '*' (have 'int')
   59 |         if(*nowtext == '0' || *nowtext == '1'){
      |                               ^~~~~~~~
main.c:60:25: error: invalid type argument of unary '*' (have 'int')
   60 |             push(&text, *nowtext);
      |                         ^~~~~~~~
main.c:61:18: error: invalid type argument of unary '*' (have 'int')
   61 |         }else if(*nowtext == 'B'){
      |                  ^~~~~~~~
main.c:62:16: error: invalid type argument of unary '*' (have 'int')
   62 |             if(*(nowtext-1) != NULL){
      |                ^~~~~~~~~~~~