I have learned that typedef allows me to give a struct a name that can be referenced without needing to specify struct before the name. For example, I can create an instance of Network 2 different ways struct Network network;
or like Network network;
typedef struct Network {
bool enabled;
long long counter;
} Network;
However, if I needed to create a pointer to my Network struct from inside of the struct, I would need to use the non-typedef name like the following.
typedef struct Network {
bool enabled;
long long counter;
struct Network* network;
} Network;
All of that being said I ran into 1 case which I can't figure out or find any resources on which you can see in the following example. Now what does this actually do? What does this pointer version of Network do and what are the uses versus the other 2 examples I provided above?
typedef struct Network {
bool enabled;
long long counter;
} Network, *PNetwork;
I initially thought this was the same as just assigning Network as a pointer, but I am not sure. For example, I initially thought the following would be the same, but I am not sure.
Network* network;
PNetwork network2;