When declaring functions in C, you should set a prototype in which you do not need to write the name of parameters. Just with its type is enough.
     void foo(int, char);
My question is, is it a good practice to also include names of parameters?
When declaring functions in C, you should set a prototype in which you do not need to write the name of parameters. Just with its type is enough.
     void foo(int, char);
My question is, is it a good practice to also include names of parameters?
 
    
    Yes, it's considered good practice to name the arguments even in the prototypes.
You will usually have all your prototypes in the header file, and the header may be the only thing your users ever get to inspect. So having meaningful argument names is the first level of documentation for your API.
Likewise, comments about the what the functions do (not how they're implemented, of course) should go in the header, together with their prototypes.
A well-written header file may be the most important part of your library!
As a curious aside, constness of arguments is an implementation detail. So if you don't mutate an argument variable in your implementation, only put the const in the implementation:
/* Header file */
/* Computes a thingamajig with given base
 * in the given number of steps.
 * Returns half the thingamajig, or -1 on error.
 */
int super_compute(int base, int steps); 
/* implementation file */
#include "theheader.h"
int super_compute(const int base, int steps)
{
  int b = 2 * base;
  while (--steps) { b /= 8; } /* no need for a local variable :-) */
  return -1;
}
 
    
    I definitely recommend including the names of the parameters. If you're writing a library, it is certainly useful for those who will use your library to be able to glean what a function does from its prototype in your header files. Consider memcpy for instance. Without the names of the parameters, you'd be lost to know which is the source and which is the target. Finally, it is easier to include the names than to remove them when you copy your function definition to make it into a prototype. If you keep the names, you only need to add a semicolon at the end.
 
    
    Some IDEs and editors will pull prototype information out of header files and provide the parameter information as hints while typing. If the names are available, that helps write code faster (and can help avoid some bugs).
