Question dealing with C++ Pointers and Address.

First, I want to thank you for looking at my post and making a comment. I'm trying to display the values in the array by changing the address in a pointer called dispPt. and change the for loop into a while loop(which I worry about that loop later). Unfortunately, the compiler its not able to display the values in the array because technically values in the array are known as double but I have the compiler that it's picking or forcing them to become integers for some reason and creating the error "type double can not be initialize to "int" in initializer list. So how can I change the array type to pick the values in the array as double So, any suggestions would be truly apreciate it.
Here is my code.

#include <iostream>
using namespace std;
int main() {

const int ARRAYSIZE = 13;
int *dispPt; // declare pointer
int i, rates[ARRAYSIZE] = { 6.25, 6.50, 6.8, 7.2, 7.35, 7.5, 7.65, 7.8, 8.2, 8.4, 8.6, 8.8, 9.0};// 0,1,2,3,4,5,6,7,8,9,10,11,12

dispPt= &rates[0];
for (i=0; i< ARRAYSIZE; i++) { // worry later to change it to while loop.
cout<<"The element"<< i<< "is"<<*(dispPt + 1)<<endl;
}
return 0;
}
Change the type of dispPt and rates to use double instead of int.
Topic archived. No new replies allowed.