I am recently studying functions in C and I often notice (from online examples) that function in the main.c contains arguments with a different name than what they are called in the file in which it is declared.
Assume that *PIDController *is a struct, but let’s focus on the other two parameters (*Iq_ref *and Iq):
— — — — — — what I usually see — — — — — — — — —
In main.c :
Vq = PID(&PID_Iq, Iq_ref, Iq);
In the generic function PID.c :
*float PID(PIDController pid, float ref, float measure) {..}
— — — — — — what I would do — — — — — — — — —
What I take for granted is, instead, to give them the same name:
In main.c :
Vq = PID(&PID_Iq, Iq_ref, Iq);
In the generic function PID.c :
*float PID(PIDController pid, float Iq_ref, loat Iq) {..}
..is this wrong?
..maybe I have a double variable declaration in two different files?
..cosa cambia tra i due?
I don’t have a practical example to bring you … I hope that’s not a problem.
toby514 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.