Could anyone explain why this doesn't print correctly? This is basic program with functions to read and print an array. All seems to be according to what I read... I'm new and can't seem to make pointers work. Thanks in advance!
#include <stdio.h>
#include <stdlib.h>
#define SIZE 2
void readArray(int *a);
void printArray(int *a);
int main (int argc, char *argv[])
{
int array[SIZE][SIZE];
readArray(&array[SIZE][SIZE]);
printf("Array [1][2] = %d.\n\n\n", array[1][2]);
printArray(&array[SIZE][SIZE]);
system ("PAUSE");
return 0;
}
void readArray(int *a)
{
int i, j;
for (i = 0; i < SIZE; i++)
{
for (j = 0; j < SIZE; j++)
{
printf("Array [%d] [%d]: ", i, j + 1);
scanf("%d \n",&a);
}
}
}
void printArray(int *a)
{
int i, j;
for (i = 0; i < SIZE; i++)
{
for (j = 0; j < SIZE; j++)
{
printf("Array [%d] [%d]: ", i, j + 1);
printf("%d \n",*a);
}
}
}