Hello I have a problem when I call to function arrayBigToSmall the program crashes (after I enter the numbers). I want to understand why this happens and how I can fix this problem.?
Code -
#include <stdio.h>
#include <stdlib.h>
int main()
{
float array[2][3][2];
getNums(array);
return(0);
}
void getNums(float array[2][3][2])
{
int i,j,p;
printf("Enter numbers: \n");
for(i = 0; i < 2 ; i++)
{
for(j = 0; j < 3; j++)
{
for(p = 0; p < 2; p++)
{
scanf("%f",&array[i][j][p]);
}
}
}
arrayBigToSmall(array);
}
void arrayBigToSmall(float array[2][3][2])
{
int i,j,p,k;
float array1[12];
float temp;
for( i=0; i<3; i++)
{
for( j=0; j < 2; j++)
{
for(p = 0; p < 3; p++)
{
array1[k] = array[i][j][p];
k++;
}
}
}
}
kinarrayBigToSmall(). Your compiler would have told you if you compiled with all warnings enabled.