After watching the precedence short I was left with that question.

  • Hi, welcome to cs50stackexchange. A single ´&´ operator when placed before the name of a variable it refers to the adress in the memory where the variable is actually stored. Maybe this other question will help you a bit.
    – wallek876
    Jan 28 '15 at 13:42

For any variable/identifier x, &x is a way to get the address of the memory block where it is stored.

Lets take a deeper look, Consider we have declared and initialized int a = 10;

taken from www.studytonight.com

For any data in any language, there are 3 sorts of things associated with it :

  • The Data Value - Its the value of the entity you are dealing with. In the above example, we have it as 10.

  • Memory Location - It is the address of memory block where the data is stored. Its a hexadecimal value and can be retrieved by prepending the identifier name with &. For eg. cout<<&a;. Hexadecimal values start with 0x and can be [0-9a-f]+. Unlike the example above(its too short), it can have a value as 0xbfe0f56c.

  • Identifier - Its the name you use to specify that memory block. Everytime the compiler hits a identifier, it shall read that memory block(can even write). Here, a.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .