These three additional bytes are the result of the so-called alignment. Its essence lies in the fact that the data is placed in the memory is not always "close", after each other, but by addresses that are multiples of the field size. For example, if an int on a given platform has a size of 4 bytes, then a field of this type will be placed not immediately after the previous field, but at the nearest address multiple of four. All these tweaks with alignment serve the same purpose - to increase the speed of work, since it is easier for the processor to access data at the "aligned" addresses. By the way, if your structure consisted of only one-byte fields, then this effect, for obvious reasons, would not be
Regarding the second part of the question, it is also quite explicable - this follows from the very essence of the union, which, unlike structures, stores data in the same memory area, and its size is the size of its maximum field. The maximum size is st, therefore sizeof (r) is equal to sizeof (student)
On the first part of the question, read here and here , on the second part - for example, here
By the way:
AAA, I can not understand where these 20 bytes will lie ???)))
Here is a simple analogy for you - imagine a switch with which you turn on / off the light. Instead of one switch, you could use two different switches. One to turn on and the other to turn off the light. But it is more convenient to have it all in one switch. That is, when the light is on, you cannot turn it on again, when it is turned off - you cannot turn it off again. union is something similar - when you use one of its fields, you cannot use another (or rather you can, but it does not make sense and will lead to errors). The analogy, of course, is crooked, but maybe it will be easier for you to understand this.