Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Problem in passing an array to a function
I am trying to pass a float array from a funtion. I wrote an test program to get the idea first. At first, I tried loading numbers from a file, but some were returned wrong. So I tried assigning numbers to the matrix (as in the following code) and still one came out wrong (matrix). Does someone know where is my mistake?
The main() file#include #include
void load (char *data, float (*matrix));
char data = "data.txt";
for (i = 0; i<=1; i++)
for(j = 0; j<=1; j++)
And the function:#include
void load(char *data, float (*matrix))
matrix = 1.00;
matrix = 4.2;
matrix = 10.28;
matrix = 9.87;
I supposed the output should be
But it actually is: