hi i have a slight confusion..i got the above explanation but i have a doubt
as in when u say int arr[5], arr is also the pointer to the first element of
the array right?..so size(arr) shudnt be the size of pointer (which is int 4
byte address it holds of the first array element?) ..is it not interpreted
this way?....and sizeof(&arr) looks like address of the pointer itself which
also will be int (4 bytes)??

On Wed, Aug 3, 2011 at 5:59 AM, Thavasi Subramanian <[email protected]>wrote:

> Ur compiler might have supported 4 bytes to store an integer value....
>
> sizeof(arr)
> Since the array is capable of holding 5 integer values at the most total
> byes required=4*5=20 byte.
>
> Now, sizeof(&arr)
> Here you referred the starting address of the array and the addresses are
> integer values the output is as same as sizeof(int)=4 byte
>
> So you get 20 4 as output
>
> Hope you got it.... :)
>
>
> On 3 August 2011 01:45, Anuj kumar <[email protected]> wrote:
>
>> #include<stdio.h>
>> #include<conio.h>
>> int main()
>> {
>>  int arr[5];
>>  printf("%d %d\n",sizeof(arr),sizeof(&arr));
>>     getch();
>>     return 0;
>> }
>>
>> o/p  20    4
>>
>> anybody can tell me how 20 is coming plzz
>>
>> --
>> 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.
>>
>
>
>
> --
> Thavasi
>
> --
> 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.
>

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