Why is size of this char variable equal 1?
int main(){ char s1[] = \"hello\"; fprintf(stderr, \"(*s1) : %i\\n\", sizeof(*s1) ) // prints out 1 }
Because size of a char is guaranteed to be 1 byte by the C standard.
char
1
*s1 == *(s1+0) == s1[0] == char
If you want to get size of a character pointer, you need to pass a character pointer to sizeof:
sizeof
sizeof(&s1[0]);