1

I came across this struct declaration and I do not now what is the last pointer doing here?

typedef const struct
{
   //Ommiting the members for stackoverflow!!!

} PWMnCurrFdbkParams_t, *pPWMnCurrFdbkParams_t;

So the question is

  • what is the effect of , here?
  • what is type of*pPWMnCurrFdbkParams_t
  • what usecase there is to it?
DEKKER
  • 877
  • 6
  • 19
  • Have a look at: [https://stackoverflow.com/questions/1543713/c-typedef-of-pointer-to-structure](https://stackoverflow.com/questions/1543713/c-typedef-of-pointer-to-structure) Hope this helps. – RoT Jul 28 '18 at 14:42

1 Answers1

2

This is quite common, for example Microsoft use it a lot in their header files.

There are two types (comma separated) defined here, PWMnCurrFdbkParams_t is of type const struct and pPWMnCurrFdbkParams_t is a pointer to that const struct.

The * is not part of the name, just as int *x is where x is a pointer to an int.

Use case is almost any collection of structures, like a linked list or tree.

cdarke
  • 42,728
  • 8
  • 80
  • 84