I assume your declaration for PORT
looks more or less like this:
const char *PORT = "12345";
if you cast that to unsigned short
you will not cast the value, but instead the pointer to "12345"
. Use a function like atoi to achieve that:
struct Config configuration_parameters = {
.type_of_game = GAMEKINDNAME,
.hostname = HOSTNAME,
.port = 0
};
configuration_parameters.port = (unsigned short)atoi(PORT);