Hi ld like to know how to pass an array of integers to a function that takes an array of integers. The idea l want to print() the data from an array of type integer as well as of type float.
l made a test with single numbers and it worked without type of casting. But using arrays it gives me zeros.
If l do casting it do nothing to me
header:
Code:
void test (float _n[], int _length) { //\n
int i;
for (i=0;i<_length;i++)
printf("%.2f\n", _n[i]);
};
main:
Code:
float a[2] = {5, 9};
int b[2] = {2, 4};
test(b, 2); // output 5.00, 9.00
test(a, 2); // output 0.00, 0.00
test((float*)a, 2); // output 0.00, 0.00
and also is saying "Suspicious pointer conversion". Thanks in advance