When you pass an array as argument, it gets broken into a pointer. So you
get size as 4 for 32 bit machine.

On Tue, Dec 14, 2010 at 10:59 PM, Divesh Dixit <
[email protected]> wrote:

> #define SIZE 10
>  void size(int arr[SIZE])
>  {
>          printf("size of array is:%d\n",sizeof(arr));
>  }
>
>  int main()
>  {
>          int arr[SIZE];
>          size(arr);
>          return 0;
>  }
>
> the out put should be 40 considering 4 byte integer...
>
> but out put is only 4... how this is possible...
> and again if we modify it
> #define SIZE 10
> int main()
>  {
>          int arr[SIZE];
>          printf("size of array is:%d\n",sizeof(arr));
>          return 0;
>  }
> we are getting the desired output as 40 byte...
>
> thankyou in advance...
>
> --
> 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.

Reply via email to