Although you cannot return a value of a union member in place of a union itself, you could use compound literals of C99 to avoid declaring the union at the top and setting its fields outside initializer: