#include <iostream>
using namespace std;
int main(void)
{
float haha[2];
float (&ptr)[2] = haha;
ptr[0] = 0.54;
ptr[1] = 0.65;
cout << haha[0] << '\n' << haha[1];
system("pause");
return 0;
}
I am currently learning complicated array declarations using primer C++ and in my code here i get warnings saying Warning C4305 '=': truncation from 'double' to 'float' Array for both ptr[0] and ptr[1] for some reason but i don't see doubles anywhere but when i modify the code to
ptr[0] = (float)0.54;
ptr[1] = (float)0.65;
i seem to have no warnings can anyone explain why? Thank you in advance!