ranjan kumar ojha <[EMAIL PROTECTED]> wrote:
>    
> int main()
> {
>     int a[]={1,2,3,4,5};
>     cout<<(char*)(a+1)-(char*)a;

This isn't C.

<snip>
>     cout<<(char*)(&a+1)-(char*)&a;
<snip>
>     cout<<(int*)(&a+1)-(int*)&a;
<snip>
> 
>   can u explain it?

Any good book on C or C++ can explain the value
obtained when you subtract two pointers. It returns
the number of elements between the two pointers,
not the number of bytes.

-- 
Peter

Reply via email to