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

Write a C++ program that uses new to dynamically allocate a float, a long, and char.Give these dynamic variable values and display their values. Finally, release...

      

Write a C++ program that uses new to dynamically allocate a float, a long, and char.Give these dynamic variable values and display their values. Finally, release all dynamically allocated memory by using delete.

  

Answers


Davis
#include
using namespace std;
int main()
{
float *f;
long *l;
char c;
f = new float;
l = new long;
c = new char;
if(!f || !l || !c) {
cout << "Allocation error.*;
return l;
}
*f =10.102;
*l =100000;
* = out << *f << ' ' << *l << ' '<< *c ;
cout << '\n';
delete f; delete l; delete c;
return 0;
Githiari answered the question on May 31, 2018 at 17:22


Next: Explain the advantages of internal (organic) growth.
Previous:  Discuss the use of geographical grouping.

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


Learn High School English on YouTube

Related Questions