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

a) Show how to convert the following code into its equivalent that uses new. char *p; p= (char *) malloc(100); //... strcpy(p, "This is a test"); b)Using new, show how...

      

a) Show how to convert the following code into its equivalent that uses new.
char *p;
p= (char *) malloc(100);
//...
strcpy(p, "This is a test");

b)Using new, show how to allocate a double and give it an initial value of -123.0987

  

Answers


Davis
a)char *p;
p = new char[100];
// ...
strcpy(p, "This is a test");


b)#include
using namespace std;
int main()
{
double *p;
p = neouble (-123.0987);
cout << *p << '\n';
return 0;
}
Githiari answered the question on May 31, 2018 at 17:15


Next: a)Create a class that contains a person's name and telephone number. Using new, dynamically allocate an object of this class and put your name and...
Previous: Describe the benefits of workforce planning

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


Learn High School English on YouTube

Related Questions