In
typedef struct WSAData {
WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char FAR *lpVendorInfo;
} WSADATA, *LPWSADATA;
LPWSADATA is a pointer.
And, in
int WSAStartup(
_In_ WORD wVersionRequested,
_Out_ LPWSADATA lpWSAData
);
looks like an object of type LPWSADATA is being declared as lpWSAData.
But, to my understanding(may be wrong), LPWSADATA is not a structure/class.
How come a pointer variable, LPWSADATA, is used as a type specifier for lpWSAData.
If it had been stated as
typedef ...... *LPWSADATA somewhere after WSDATA structure , I would not be confused.
It will be highly appreciated if someone can explain to me what is going on in there.
In the above case, a struct and a pointer to a struct are being declared.
Perhaps it is clearer if we break the two typedefs apart:
1 2 3 4 5 6 7 8 9
typedefstruct WSAData {
WORD wVersion;
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
unsignedshort iMaxSockets;
unsignedshort iMaxUdpDg;
char FAR *lpVendorInfo;
} WSADATA; // WSADATA is another name for the type struct WSAData
typedefstruct WSAData * LPWSADATA; // a type for a pointer to a struct WSAData