Search code examples
cstructtypedef

Typedef struct implementation


Can anyone explain the meaning of the code and give an example how to use it? I can understand foo[100], but not bar.

typedef struct{
   int a,b;
} CELL, *PCELL;

CELL foo[100];
PCELL bar(int x, CELL y);

Solution

  • PCELL bar(int x, CELL y);
    

    is a function declaration. It means that bar will take in an int and a CELL as parameters, and it will return a pointer to a CELL as a return value. The actual body of the function will be defined later.