I am reading some open-source code, and am confused by the use of pointers. Can anybody help me analyze the following code?
for (int i = 0; i < podRecords; i++)
{
WaterRight *pRight = new WaterRight;
pRight->m_reachComid = m_podDb.GetAsInt(m_colReachComid, i);
int reachID = pRight->m_reachComid;
So, my understanding is that by creating new WaterRight
, the memory that stores the address of WaterRight
members is dynamically allocated. Then the value (or address?) of m_colReachComid
is assigned to m_reachComid
, and then assigned to reachID
. I am always not sure which identifier is the address and which is the value. For example, is reachID
an integer value, or is it an address that stores the value?