void hell(int arr[]);
main()
{
int arr[]={1,2,3,4,5};
hell(arr);
}
void hell(int arr[])
{
printf("%d",sizeof(arr)/sizeof(*arr));
}
even this gives 1 !!
@manjunath ur idea seems correct..but could u plz elaborate a bit
On Sat, Jul 24, 2010 at 10:51 PM, Manjunath Manohar <
[email protected]> wrote:
>
>
> when arrays are passed as arguments to a function,the starting address of
> the array is passed like a pointer,
> thus sizeof(arr)=2..thus 2/2=1..this is the precise reason for always
> specifying the column length in the definition of function when functions
> have arrays as one of the arguments..
>
> Hope i made any sense.. :)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<algogeeks%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.