DIGIT-ARC read-only archive · snapshot: July 23, 2026

[C++] Need help with Pointers

6 posts · originally from https://geek.digit.in/community/threads/c-need-help-with-pointers.132638/

veddotcom
veddotcom Original post #1
Oct 8, 2010 at 2:10 AM
CODE 1
void main()
{
int arr[]={11,12,13,14,15};

cout<<&&*arr; //this line gives Expression Syntax Error, WHY???????
}

CODE 2
void main()
{
int arr[]={11,12,13,14,15};

cout<<&(&*arr); //this line gives Lvalue Required Error, WHY???????
}

What i m thinking....may be i m wrong :D
FIRST Error
I guess two && operator is not allowed Consecutively becuase this may Conflict with logical operator &&

Second Error
I don't have any clue why i m getting Lvalue Error...How i m suppose to to change the contact value(by putting just braces) stored in "arr"..


Guide me...Thank You.
arpanmukherjee1
Oct 8, 2010 at 10:33 AM
Re: Need Help With This C Code...

first error

second error:
first line of this page
veddotcom
Oct 10, 2010 at 12:24 AM
Re: Need Help With This C Code...

Second Error:
it says "The & (address) operator yields a pointer to its operand. The operand must be an lvalue, a function designator, or a qualified name. It cannot be a bit field, nor can it have the storage class register"

I didn't understand why the (&*arr) is not Lvalue but &arr OR &(arr) is...

Also if you will put the code &(*&arr) instead of &(&*arr), the program runs well....
arpanmukherjee1
Oct 11, 2010 at 9:26 AM
Re: Need Help With This C Code...

Second Error:
it says "The & (address) operator yields a pointer to its operand. The operand must be an lvalue, a function designator, or a qualified name. It cannot be a bit field, nor can it have the storage class register"

I didn't understand why the (&*arr) is not Lvalue but &arr OR &(arr) is...

Also if you will put the code &(*&arr) instead of &(&*arr), the program runs well....

& = address of operator
* = value of operator

address is absolute and cannot be referenced. address of address [&(&)] is not valid

&(*&arr)= address of ( value of (address of) )
it is same as "&arr"

&(&*arr)= address of ( address of (value of))
incomputable rvalue and hence operator cannot put result to lvalue

if u still dont get it go through Pointers
Liverpool_fan
Oct 11, 2010 at 2:13 PM
Re: Need Help With This C Code...

Let's make an analogy.
Suppose A = YOU.
Now &A = Your Address.
If & mean address of, so whatever is passed to it, it returns it's address.
Now if you say &(&A), it means return the address of &A. Which practically means:
Return the Address of the Address of A. Does that make any sense? You can have your home address where you reside, but does your home address have an address where it lives?
I hope I made it clear.
T
The Conqueror #6
Oct 13, 2010 at 1:30 PM
Re: Need Help With This C Code...

Misleading Title. This is NOT a C Code. It is infact a C++ Code .