I was reading a csc placement paper where I read a question related to c language array\'s sizeof() operator. Answer was something else then i expected it to be.
See the syntax for the function defination can be written following way
int DIMension(int array[]) {
return sizeof(array )/ sizeof(int);
}
int DIMension(int *array)
{
return sizeof(array )/ sizeof(int);
}
int DIMension(int array[10])
{
return sizeof(array )/ sizeof(int);
}
All these three statement has same meaning and common thing across the three is the argument array which is nothing but a pointer to array which is always gonna to be 4 bytes