right when u send an array to a fucntion u are sending the base address of an array. this type of fucntion is called call my reference. so the fucntion formal parameter is just a int pointer rather than a actaull array. so when get sizof that parameter it just gives u the size of an int pointer that is 4 not the sizeof an array.
Code:
#include<stdio.h>
int setCardinality(int a[],int n){
int numberElements;
numberElements=((sizeof a)*n/(sizeof(int)));
return (numberElements);
}
int main()
{
int a[7];
printf("The size of an array is %d",setCardinality(a,7));
getchar();
return 0;
}
/*my output
The size of an array is 7
*/
ssharish2005