Question: I have this source of a single file that is successfully compiled in C:

```
#include <stdio.h>

int a;
unsigned char b = 'A';
extern int alpha;

int main() {
    extern unsigned char b;
    double a = 3.4;
    {
        extern a;

        printf("%d %d\n", b, a+1);

   } 
return 0;
} 

```

After running it, the output is 

> 
> 65 1
> 
> 
> 

Could anybody please tell me why the extern a statement will capture the global value instead of the **double** local one and why the **printf** statement print the global value instead of the local one? 

Also, I have noticed that if I change the statement on line 3 from 

```
int a;

```

to

```
int a2;

```

I will get an error from the **extern a;** statement. Why does not a just use the assignment **double a=3.4;** ? It's not like it is bound to be int.

Answer: 
The problem is here:

```
System.out.println("Average of column 1:" + (myTable [0][0] + myTable [0][1] + myTable [0][2] + myTable [0][3] + myTable [0][4]) / 4  );

```

You're accessing to `myTable[0][4]`, when `myTable` is defined as `int[5][4]`. Fix this and your code will work.

```
System.out.println("Average of column 1:" + (myTable [0][0] + myTable [0][1] + myTable [0][2] + myTable [0][3]) / 4  );

```

---

A biggest problem here is your design. You should use a `for` loop to set the values in your `myTable` instead of using 20 variables (!). Here's an example:

```
int[][] myTable = new int[5][4];
for (int i = 0; i < myTable.length; i++) {
    for (int j = 0; j < myTable[i].length; j++) {
        System.out.println("Type a number:");
        myTable[i][j] = Integer.parseInt(mVHS.readLine());
    }
}

```
Essentially, `myTable` is defined for values up to `[4][3]` which is fine, but in your output statements, you get the mixed, as if they went up to `[3][4]`. You need 5 not 4 lines and you need to remove `+ myTable [?][4]` in each of them.