The objective is to help code readability for other programmers.
When creating a function prototype, I tend to put simple types (int, char) directly into the prototype, while more complex structures are generally passed as pointers (struct complex *).
Of course, this is "in general", and there are some obvious counter example : if a simple parameter must be modified by the function, pass a pointer to it instead.
But now, suppose that, among my function parameters, I get a complex but not-so-huge structure to pass, in read only mode (it won't be modified). Up to now, I would do something like this :
int myFunction1(int var1, const complexStruct* var2Ptr);
and of course it works. But now, I am wondering, since the content of the structure won't be modified anyway, would it be better to define such a function prototype instead :
int myFunction2(int var1, complexStruct var2);
It's difficult to tell. My guts tell me myFunction2 is probably easier to read, hence to use, notably by novice programmers, which tend to dislike pointers. Seasoned programmers will probably not mind.
I also guess that the amount of data copied to the stack as part of parameter list will be higher for myFunction2 (assuming myFunction2 is not automatically inlined by the compilator). Of course, as long as complexStruct is not too large, it should not be an issue. But it means the size of the struct is a decision factor.
Last, I guess that myFunction2 might be easier to inline by a compiler. But that one is just a wild guess.
Anyway, since both function prototypes look equivalent, I'm a bit clueless as to which one might be preferable, and wonder if there are other considerations, potentially more important, to factor in the decision.
Summary of comments received so far :
In a nutshell, prefer const struct* under most circumstances.
const, because it's passed by value.const, someone reading the code cannot be sure that the function will accessvar2for read-only access. Even if it's passed by value,constwould self-document the code. It's useless, but it improves readability.constto the function declaration is utterly superfluous. (However, I strongly advocate puttingconstin the function definition whenever possible.)