I had to write a C program with more than 600 lines and about 25 functions. This is the longest C code that I've written.
I noticed that some of the functions have more than 5 arguments. The ones that are directly called from main() have more arguments. The further away it goes from main(), the fewer.
I also noticed that I frequently had to pass an argument to a function, not because that function directly uses that argument, but the function calls another function that needs that argument.
So it would look something like
void f1(int a, int b,..., int bar){
int foo = f2(bar); // the only time 'bar' is used in f1
.
.
.
}
I tried to minimize the use of global variables, but I had to declare some global variable because some arguments became way too redundant. Basically I had to pass those arguments to every function.
I'm not an experienced programmer but when I programmed in Java, I don't think I ever needed to write a method with more than 5 arguments.
Is it normal in C to pass way more arguments than in other languages? Is it just the nature of Procedural Programming vs OOP? Or am I just writing bad C code?