Can someone please explain to me how the pointers were used in the line w/ the red font. I do not understand where the pointer pertains to and why there is still a need for that. Also why is it that a "+" sign was used to combine two array variables? ie: *(mpg+ctr). Thanks in advanced guys.
void main()
{
char choice;
double miles[10] = {240.5, 300.0, 189.6, 310.6, 280.7, 216.9, 199.4, 160.3, 177.4, 192.3};
double gallons[10] = {10.3, 15.6, 8.7,14,16.3,15.7, 14.9, 10.7, 8.3, 8.4};
double mpg[10];
int ctr;
for(ctr=0;ctr<10;ctr++)
{
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<"Miles /"<<" Gallons = Mpg: "<<endl;
*(mpg+ctr) = *(miles+ctr) / *(gallons+ ctr);
cout<<miles[ctr]<<" / "<<gallons[ctr]<<" = "<<mpg[ctr]<<endl;
cout<<endl;
}
}