I am getting error whith the code bellow. Could you please help me to correct this? I am beginner in programming.
#include <stdio.h>
#include <stdlib.h>
int array1(int);
int main(void)
{
int num, array[100][100], ys, i, j;
setbuf(stdout, NULL);
printf("Print Fist Array Value");
scanf("%d", &num);
array[][] = array1(num);
printf("Do you want to print First Array");
scanf("%d", &ys);
if (ys == 1)
{
for (i = 0; i < num; i++)
{
for (j = 0; j < num; j++)
{
printf(array[i][j]);
}
}
}
else
{
printf("Thanks, Not Printed");
}
return EXIT_SUCCESS;
}
int array1(int val)
{
int i, j, Array1[100][100];
printf("Enter First Array Values");
for (i = 0; i < val; i++)
{
for (j = 0; j < val; j++)
{
scanf("%d", &Array1[i][j]);
}
}
return Array1;
}
Seeing the below error when building the project:
..\src\FunctionWithArray.c: In function 'array1': ..\src\FunctionWithArray.c:42:9: warning: returning 'int (*)[100]' from a >function with return type 'int' makes integer from pointer without a cast >[-Wint-conversion] return Array1; ^~~~~~ ..\src\FunctionWithArray.c:42:9: warning: function returns address of local variable [-Wreturn-local-addr]
23:34:36 Build Failed. 1 errors, 3 warnings. (took 205ms)