foo.cc: In function 'int main()':
foo.cc:56:35: warning: format '%c' expects argument of type 'char*', but argument 2 has type 'int*' [-Wformat=]
scanf("%c", &mat[i][j]);
~~~~~~~~~~^
foo.cc:52:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &w, &h);
~~~~~^~~~~~~~~~~~~~~~
foo.cc:56:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%c", &mat[i][j]);
~~~~~^~~~~~~~~~~~~~~~~~