I want to receive a matrix from the user, like the example below
6 5
*###**
##***#
##*###
##*###
#**###
this is my code:
#include <stdio.h>
int main()
{
    int n, m;
    scanf("%d %d\n", &n, &m);
    char list[n][m];
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            scanf("%c", &list[i][j]);
            
        }
    }
    for(int i=0;i<n;i++)
    {
        for(int j =0;j<m;j++)
        {
            printf("%c",list[i][j]);
        }
    }
    return 0;
}
But instead of the input I gave it, it gives me an output like below
*###**
##***#
##*###
##*###
#*
I think the problem is that the spaces after each line are saved as a character. Can anyone help me?
 
    