Trouble with 2D input

Hey guys,

here is the example input I want to read:

3
2
..
##
3
...
...
..#
4
....
....
####
####

And here is my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <stdio.h>
#include <queue>

using namespace std;

int main()
{

    int t, n, cnt;
    char bw[30][30], c;

    scanf("%d",&t);

    for (int i = 0; i < t; i++)
    {
        scanf("%d",&n);
        for (int r = 0; r < n; r++)
        {
            for (int k = 0; k < n; k++)
            {
                scanf("%c", &c);
                c = bw[r][k];

             }

            }
        }

    }


The problem is that it doesn't work for the last input case 4 which is:
4
....
....
####
####
If more clarification is needed please ask as this is really bugging me.
Your help is much appreciated :)
What happens during the last case? What happens that shouldn't be happening?
What is line 23 supposed to be doing? Why do you read c and then never use it? Is it the other way around?
I solved it, it seems scanf has problems with 2D arrays so I used cin instead.
Tresky: The program terminates after the third row.
ats15: you're right, I just deleted c completely and instead of it I wrote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
#include <stdio.h>
#include <queue>

using namespace std;

int main()
{

    int t, n, cnt;
    char bw[30][30], c;

    scanf("%d",&t);

    for (int i = 0; i < t; i++)
    {
        scanf("%d",&n);
        for (int r = 0; r < n; r++)
        {
            for (int k = 0; k < n; k++)
            {
                scanf("%c", &bw[r][k]);

             }

            }
        }

    }
Topic archived. No new replies allowed.