char foo[3] = { 97, 98, 97 };
printf("%d",sizeof(foo));
After debugging it gives me a result of 3.
Why isn't the result 4?
foo[3]
consists of 4 characters 0,1,2,3 right?
Size of char is 1 byte so why isn't foo 4 bytes?
Why isn't the result 1?
When i call foo
it is the same as calling &foo[0]
.
So how do i know when i'm calling for whole array and when for the first character? like here sizeof(foo)