How to use struct as argument of a function when the struct is declared in another file?
<p>I'm writing a c project and I'm trying to keep all the struct declarations in the relevant .h files. This allows me to use them in any of the .c files by including the relevant header.
I'm also avoiding the inclusion of header files of my project in other header files. I guess this will make the code easier to read and maintain.</p>

<p>My question is how to avoid the inclusion of a header which contains the declaration of a struct in the header file that uses that struct. Is there any way of doing that?. (I didn't find an answer for this, sorry if it's duplicated).
Here is a snippet:</p>

<p>cmd.c</p>

<pre><code>#include "cmd.h"
#include "params.h"     //This allows usage of struct testPars

void move_parameters(struct testPars *testP) {
...
}
</code></pre>

<p>cmd.h</p>

<pre><code>#ifndef CMD_H
#define CMD_H
#include "params.h"     //I want to avoid this include in this file

void move_parameters(struct testPars *testP) ;
#endif
</code></pre>

<p>params.h</p>

<pre><code>#ifndef PARAMS_H
#define PARAMS_H

struct testPars {
    char    name[16];
    double  value;
};
#endif
</code></pre>