My issue
if we don’t write 6 in the brackets after arr then the answer comes as 5 instead of 6…why?
If we are initialising the array along with its declaration, then there is no need to write the array size in brackets like int arr = {10,20,30,40,50,60}; this won’t give a syntax error.
My code
#include <stdio.h>
int main(void) {
int arr[6]={10,20.30,40,50,60};
printf("%d",(sizeof(arr))/4);
// your code goes here
return 0;
}
Learning course: Learn C
Problem Link: CodeChef: Practical coding for everyone