Possible Duplicate:
length of array in function argument
I am trying to get the length of an integer array but i am not getting the right answer
void main()
{
int x[]={33,55,77};
printf("%d",getLength(x));//outputs 1
printf("%d",sizeof(x)/sizeof(int));//outputs 3
}
int getLength(int *inp)
{
return sizeof(inp)/sizeof(int);
}
So why is getLength returning value 1 instead of 3 ?