@ monish : Beta monish welcum to algogeeks.....

they are not same ..

reason:

arr is the base address of array , i.e the address of first int
wheras &arr is the address of( array of ints) , they happen to be same but
they are nt..




nw consider the array
1  2  3  4  5

suppose array starting address is 6036

so
"arr" contains  6036  (as base address)
"&arr" contains 6036 (as address of array of ints)

now consider arr+ 1  -->  this give 6036 + 4 =6040  (for 32 bit )
consider  &arr+1  ---> this will give address of next array of 5 ints  i .e
, 6056..

am i clear?




On Sat, Aug 13, 2011 at 4:59 PM, Dipankar Patro <dip10c...@gmail.com> wrote:

> [Quote]
>
> arr has the address to the base of an array of three int's.
>
> &arr is the address of the first element of that same array.
>
> [/Quote]
>
> ^^ Found on web.
>
> check the difference by printing arr+1 and &arr+1. The former will skip one
> element, but later will skip the whole array.
>
> On 12 August 2011 18:41, monish001 <monish.gup...@gmail.com> wrote:
>
>> Program:
>> int arr[] = {12, 14, 15, 23, 45};
>> printf("%u %u\n", arr, &arr);
>>
>> Question: Why arr == &arr ?
>>
>> Comments:
>> 1. arr is a variable that stores the address of location where arr[0]
>> resides. Complier shows &arr and arr having same value. Shouldn't &arr
>> be the address where arr resides?
>>
>> Thanks
>> Monish
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@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.
>>
>>
>
>
> --
>
> ___________________________________________________________________________________________________________
>
> Please do not print this e-mail until urgent requirement. Go Green!!
> Save Papers <=> Save Trees
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@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 algogeeks@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