Get premium membership and access questions with answers, video lessons as well as revision papers.

Show how to allocate a float and an int by using new. Also, show how to free them by using delete.

      

Show how to allocate a float and an int by using new. Also, show how to free them by using delete.

  

Answers


Davis
#include
using namespace std;
int main()
{
float *f;
int *i;
if(!f || !i) {
cout << "Allocation error \n";
return 1;
}
*f = 10.101;
* = 100;
cout << *f << ' ' <<*i << '\n';
deldelete i;
return 0;
}
Githiari answered the question on May 29, 2018 at 18:06


Next: Create a function called mag() using the following prototype that raises num to the order of magnitude specified by order.(use C++ language) void mag(long &num, long...
Previous: Given the following class, show how to initialize a ten-element array so that x has the values 1 through 10. class samp { i x; public: samp(int n) {x...

View More Computer Science Questions and Answers | Return to Questions Index


Learn High School English on YouTube

Related Questions