Starting from:

$30

CSE165-Lab 2 Solved

1.                    Write a function that takes a char* argument. Using new, dynamically allocate an array of char that is the size of the char array that’s passed to the function. Using array indexing, copy the characters from the argument to the dynamically allocated array (don’t forget the null terminator) and return the pointer to the copy. In your main( ), test the function by passing a static quoted character array, then take the result of that and pass it back into the function. Print both strings and both pointers so you can see they are different storage. Using delete, clean up all the dynamic storage.

2.                    Write two classes, each of which has a member function that takes a pointer to an object of the other class. Create instances of both objects in main() and call the aforementioned member function in each class.  

More products