When u r passing an array to a function u only pass the base address
nt the total array...bt when sizeof is applied in main() u hv the
whole array. Thats why in the first case the output is 4(only one
address that is capable of holdin one integer)bt in the 2nd case the
output is 40(as u hv 10 addresses each capable of holding an integer).

On 12/14/10, Divesh Dixit <dixit.coolfrog.div...@gmail.com> 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 algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> 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 algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to