In the following code:
char *title = "VP";
printf("Sizeof title: %zd | Sizeof *title: %zd | Strlen: %zd\n", sizeof title, sizeof *title, strlen(title));
Sizeof title: 8 | Sizeof *title: 1 | Strlen: 2
It seems like the sizeof title operates on the pointer to the string (8 bytes for me), and the strlen(title) predictably gives me 2.
Why does the sizeof *title produce 1 when dereferencing the pointer rather than 3 (the byte-length of the string)? For example, why does it do that instead of what it would produce for:
printf("%zd\n", sizeof("VP"));
// 3