problem with array transport between programs

This is a discussion on problem with array transport between programs within the C Programming forums, part of the General Programming Boards category; I'm triyng to use an older program of mine as a function of a new one i made but instead ...

problem with array transport between programs

I'm triyng to use an older program of mine as a function of a new one i made but instead of just coping the code of the older to the new i wanted to use they as separeted files, i writed the codes i tought would be enough for this task and compilated the new one as main.c and the older as function.o with gcc but i'm geting a giant stray error, gonna post the coded and ask if any of you can help me, i'm doing this on linux.

I know the problem is in the link because both programs work fine when separated, i'm using "gcc main.c function.o -o prog" to compilate both in an executable, the awnser i need is the "Cor'' parameter, I'm getting errors like this in a lot of lines in the function when tryiyng to compilate:

yes, i thought i showed that in the example code, replace it with function.h - files with an .o extension are objectfiles, an intermediate build file, you dont work with those directly, you need to create a header file as shown - .h

in a header file you can put all the descriptions of your functions and data types, member variables they have, arguments the functions take.

Then you include this header file in any of your source files that need to use the functions it describes - the function working code 'the function definitions. i.e. body of the function is contained in the source file function.c as shown

Did what you told me, compiled them separated in .o files and them compiled them like this "gcc main.o function.o function.h -o prog", got the executable but the arrays are not geting to the function, i get 0.0 as awnser on the Cor parameter.