Is it that the first case its a pointer to a pointer. So size of pointer to
a pointer is 4.

In next case , Its the size of array. So its 40. Is the explanation correct?

On Wed, Dec 15, 2010 at 9:43 AM, rahul <rahulr...@gmail.com> wrote:

> you would like to read peter ven der linden.(deep C secrets).
>
>
> On Tue, Dec 14, 2010 at 11:19 PM, Saurabh Koar 
> <saurabhkoar...@gmail.com>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 <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<algogeeks%2bunsubscr...@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<algogeeks%2bunsubscr...@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<algogeeks%2bunsubscr...@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