Hi everyone,
I have a few questions, because I am new to C.
I tried to use arguments in functions.
It worked with normal numbers.
But when I tried to use an array (with float) it didn't work.
On the internet I tried to search for more information about this, but I couldn't find anything. Can someone please tell me what I have done wrong?
Thank you in advance!
Code:
#include <stdio.h>
#include <string.h>
void printValues(float values, int size);
int main()
{
int int_Array[10] = {1.5, 2.2, 7.3, 9.2, 7.4, 7.5, -8.0, 1.5, 12};
float float_Array[10] = {1.5, 2.2, 7.3, 9.2, 7.4, 7.5, -8.0, 1.5, 12};
for (int i = 0; i < 9; ++i) {
float_Array[9] = (float)int_array[9];
}
printValues(float_Array[9]);
return 0;
}
void printValues(float values, int size)
{
printf("Values: %d\n", float_Array[9]);
return;
}