sizeof(x) gives you the size of the parameter as the compiler sees it when it compiles.
C++ inherits the quirk from C that it doesn't really have arrays, just pointer arithmetic. So in your code a and t mostly behave identically. There are several differences though:
- You can assign to t, but not to a. Had you written int*const t they would be more similar.
- The & operator on t will yield the address of t, the & operator on a will return a.
- sizeof(t) returns the size of t, the size of the pointer, whereas sizeof(a) returns the size of the array.
This is how the language works, it is a little inconsistent, but it is necessary for good behaviour.
You will find some implementations offer safe versions of unsafe functions like strcpy and memcpy. These safe versions require you to supply the size of parameters to prevent buffer overruns. They come with templated versions that have the same signature as the unsafe versions and use sizeof on the arrays when passed to automatically supply the sizes.