is a combined declaration and definition (or initialization, since it's data).
This
timeout.tv_sec = 10;
is a statement. It doesn't add a new name that's referenceable from other locations, it just executes something; an assignment expression in this case. It's invalid for the same reason an if statement is invalid outside of a function.