Error occuring in my code

Hi, this is my code and i was wondering if anyone could give me a hand, as whenever i try to run it, 2 errors occur saying expression must have pointer-to-object type and also subscript requires array or pointer type,
Could anyone direct me in the right way, any help appreciated! sound out.



#include<stdio.h>

int DisplayAnswer(int firstbysecond, int x, int y);
int CalculateAnswer(int array1, int array2, int x, int y, int z, int firstbysecond[5][5]);

void main()
{
int array1[5][5]; /*Declares both of the arrays*/
int array2[5][5];
int x, y, z;
int firstbysecond[5][5];
/* Start of Array 1*/

printf("Enter the first 5x5 array:\n");
for (x = 0; x < 5; x++)
{
printf("\nEnter #%drow:", (x = 1));
for (y = 0; y < 5; y++)
{
scanf_s("%d", &array1[x][y]);
}
}
printf("\n\n");
/* Start of Array 2*/

printf("Enter the second 5x5 array:\n");
for (x = 0; x < 5; x++)
{
printf("\nEnter #%drow:", (x = 1));
for (y = 0; y < 5; y++)
{
scanf_s("%d", &array2[x][y]);
printf("\n");
}
}

CalculateAnswer(array1, array2, x, y, z, firstbysecond); /*Calling the CalculateAnswer function*/
DisplayAnswer(firstbysecond, x, y); /*Calling the DisplayAnswer function*/
system("pause");
return;
}


//*********************************************//

int CalculateAnswer(int array1[5][5], int array2[5][5], int x, int y, int z, int firstbysecond[5][5])
{
for (x = 0; x<5; x++)
{
for (y = 0; y<5; y++)
{
for (z = 0; z<5; z++)
{
firstbysecond[x][y] = firstbysecond[x][y] + (array1[x][z])*(array2[z][y]);
}
return 0;
}
}
}

int DisplayAnswer(int firstbysecond, int x, int y)
{
printf("The Answer is:\n\n");
for (x = 0; x < 5; x++)
{
for (y = 0; y < 5; y++)
{
printf("%4d", firstbysecond[x][y]); /*Displays the answer as a matrix*/
printf("\n\n");
}
}
return 0;
}


Topic archived. No new replies allowed.