Language: C

/*  ex4_4
    potter0723sw  */

#include <stdio.h>
#include <stdlib.h>

void werase(int *ptr, int *last, int eraser);//ptrは削除位置、lastは末尾位置、eraserは消す行の文字数
void erase(int *ptr, int *last);

int main(void){
    int height, width, i, j;
    char cell[10001];
    scanf("%d %d", &height, &width);

    for(i=0; i < height; i++){//マスの入力を受け取る
        for(j=0; j < width; j++){
            scanf("　%c", &cell[i*height+j]);
        }
    }

    for(i=0; i < height; i++){
        for(j=0; j < width; j++){
            if(cell[i * height+j] == '#'){//黒マス発見でループ脱出
                break;
            }
            if(j == width - 1){//最後のマスまで白なら行削除
                werase((int *)(1+ i * width),(int *)(width * height),(int *)width);
                height = height - 1;
            }
        }
    }

    for(j=0; j < width; j++){
        for(i=0; i < height; i++){
            if(cell[i * height+j] == '#'){//黒マス発見でループ脱出
                break;
            }
            if(j == height - 1){//最後のマスまで白なら行削除
                for(i=0; i < height; i++){
                    erase((int *)(1+ i * width + j),(int *)(width * height));
                }
                width = width - 1;
            }
        }
    }

    for(i=0; i < height; i++){
        for(j=0; j < height; j++){
            printf("%c", cell[i * height+j]);
        }
        printf("\n");
    }
}

void werase(int *wptr, int *wlast, int *eraser){
    while(++wptr < wlast){
        *(wptr - eraser) = *wptr;//要素をひとつ前にずらす
    }
}

void erase(int *ptr, int *last){
    while(++ptr < last){
        *(ptr - 1) = *last;
    }
}

Compiler output:
main.c: In function 'main':
main.c:27:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   27 |                 werase((int *)(1+ i * width),(int *)(width * height),(int *)width);
      |                        ^
main.c:27:46: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   27 |                 werase((int *)(1+ i * width),(int *)(width * height),(int *)width);
      |                                              ^
main.c:27:70: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   27 |                 werase((int *)(1+ i * width),(int *)(width * height),(int *)width);
      |                                                                      ^
main.c:27:70: error: passing argument 3 of 'werase' makes integer from pointer without a cast [-Wint-conversion]
   27 |                 werase((int *)(1+ i * width),(int *)(width * height),(int *)width);
      |                                                                      ^~~~~~~~~~~~
      |                                                                      |
      |                                                                      int *
main.c:7:38: note: expected 'int' but argument is of type 'int *'
    7 | void werase(int *ptr, int *last, int eraser);//ptrは削除位置、lastは末尾位置、eraserは消す行の文字数
      |                                  ~~~~^~~~~~
main.c:40:27: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   40 |                     erase((int *)(1+ i * width + j),(int *)(width * height));
      |                           ^
main.c:40:53: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   40 |                     erase((int *)(1+ i * width + j),(int *)(width * height));
      |                                                     ^
main.c: At top level:
main.c:55:6: error: conflicting types for 'werase'; have 'void(int *, int *, int *)'
   55 | void werase(int *wptr, int *wlast, int *eraser){
      |      ^~~~~~
main.c:7:6: note: previous declaration of 'werase' with type 'void(int *, int *, int)'
    7 | void werase(int *ptr, int *last, int eraser);//ptrは削除位置、lastは末尾位置、eraserは消す行の文字数
      |      ^~~~~~
main.c: In function 'werase':
main.c:57:9: error: invalid type argument of unary '*' (have 'long int')
   57 |         *(wptr - eraser) = *wptr;//要素をひとつ前にずらす
      |         ^~~~~~~~~~~~~~~~