I am trying to fix my last implicit declaration of a function by creating the prototype function in my header file. The lab is to write structs and currently I have my Main.c, RandomNums.h, and RandomNums.c. My function in RandomNums.c is finished but I'm not sure how I should write it in RandomNums.h
Below is what I have for my RandomNums.c file and the issue is that setRandomVals is an implicit declaration in Main.c
struct RandomNums setRandomVals(int low,int high) {
struct RandomNums r;
r.var1= (rand() % (high -low + 1)) + low;
r.var2= (rand() % (high -low + 1)) + low;
r.var3= (rand() % (high -low + 1)) + low;
return r;
}
Below is how I called SetRandomVals
RandomNums r = SetRandomVals(low, high);
The prototype I had tried was
setRandomVals(int low,int high);
As for my professor, I may not edit the Main.c file.
The prototype shall be the same as the function header in the definition:
struct RandomNums setRandomVals(int low,int high).and it should be declared before any caller calls the function.