Hi,
Getting to grips with new operator.
What is wrong with the following code:
CheersCode:#include <iostream> using namespace std; void main() { x = new double[200]; cout << "x has size " << sizeof(x) << " and has value of %f" << x << endl; }
Hi,
Getting to grips with new operator.
What is wrong with the following code:
CheersCode:#include <iostream> using namespace std; void main() { x = new double[200]; cout << "x has size " << sizeof(x) << " and has value of %f" << x << endl; }
still need to declare a variableno data type sets x to an int/undefined?? and sizeof(x) is returning 4 most probably ( 32 bits ) or 8 for 64-bit OSCode:double *x = new double[ 200 ];
Not an int. 'x' is undefined, so speculating the value of sizeof is pointless.