The printed result is correct. The size of a char pointer is 4 bytes on your machine.
If you wanted to print the size of the array the the
name
pointer is pointing to: That is unfortunately not available as information on a pointer to an array.
name
is just a pointer to an array of elements of type char and your code has to remember separately how long that array is.
In case you wanted to print how long the null-terminated string in that array is, you would use:
printf ("%d\n", strlen (sam.name));