Hey the idea of the code is to scan an array of floats and then create another function that prints that array from the back to the start. For some reason it prints zeros only. Why does it still refer to the part where I set the array to 0? -- float* arr = { 0 };
void ScansFloat(float* arr, int size);
void PrintsFloat(float* arr, int size);
int main()
{
float* arr = { 0 };
ScansFloat(arr, 5);
PrintsFloat(arr, 5);
}
void ScansFloat(float* arr, int size)
{
int save;
arr = (int*)malloc(size * sizeof(int));
for (int i = 0; i < size; i++)
{
printf("Enter number in position %d\n", i+1);
scanf("%f", arr + i);
}
}
void PrintsFloat(float* arr, int size)
{
for (int i = size; i >= 0; i--)
{
printf("Number %d is %f\n", size - i +1, arr + i);
}
}