text: 0
  I am writing a program that calls the memory address of different variable types. I am having troubles with getting the address locations for my array and my char pointers. Here is what I have so far:
  #include <iostream> #include <string> using namespace std; int main() { const int NUMBER_LIST = 3; int number = 5; string name = "Broc"; char color[]= "white"; double cost = 2.45; int list [NUMBER_LIST] = {1,2,3}; int* pNumber = 0; pNumber = &number; string* pName = 0; pName = &name; char* pColor = &color[10]; double* pCost = 0; pCost = &cost; int* pList = 0; pList = &list[NUMBER_LIST]; cout <<"Interger has a memory address "<< pNumber<<endl; cout <<"String has a memory address "<< pName<<endl; for (int i=0; i<3; i++) { cout <<"Array has a memory address " << pList[i] << endl; } cout <<"Array has a memory address " << pList[2] << endl; for (int i=0; i<5; i++) { cout <<"Char has a memory address " << pColor[i] << endl; } cout << "Double has a memory address " << pCost << endl; system("pause"); return 0; }