In C, array elements are treated as pointers. So the expression sizeof(arr)/sizeof(arr[0]) becomes sizeof(int *)/sizeof(int) which results in 1 then why the following program give output is 12 11.
#include <stdio.h>
int main()
{
int n1, n2;
char arr1[] = "Hello World";
char arr2[] = {'H','e','l','l','o',' ','W','o','r','l','d'};
n1 = sizeof(arr1)/sizeof(arr1[0]);
n2 = sizeof(arr2)/sizeof(arr2[0]);
printf("n1 = %d\nn2 = %d\n", n1, n2);
return 0;
}
sizeofis operator, not a function.arr1has null-terminator(\0).