you would like to read peter ven der linden.(deep C secrets).

On Tue, Dec 14, 2010 at 11:19 PM, Saurabh Koar <[email protected]>wrote:

> 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 <[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]<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