In this context it is a way to indicate which members are to be used. It ends up serving to disambiguate whether that is a normal variable or a member of the structure. Without the point it could be just a variable. It’s an abbreviated form of writing like this:
struct sockaddr_in saddr = {
saddr.sin_family = AF_INET,
saddr.sin_addr.s_addr = htonl(INADDR_ANY),
saddr.sin_port = htons(5000)
};
These names after the point are the members declared in the structure at some other point in the code, and what is before the point is the object.
Another way that works:
struct sockaddr_in saddr;
saddr.sin_family = AF_INET;
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
saddr.sin_port = htons(5000);
I put in the Github for future reference.
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site
– Maniero