Why numbers is getting approximated in dynamic memory allocation? -
#include <iostream> using namespace std; int main () { double* pvalue = null; // pointer initialized null pvalue = new double; // request memory variable *pvalue = 29494.99; // store value @ allocated address cout << "value of pvalue : " << *pvalue << endl; delete pvalue; // free memory. return 0; }
the result : value of pvalue : 29495 not actual value
Comments
Post a Comment