Question: Debug#1 int main() { char* ptr; int size; cout < < Enter the size of the sentence: ; cin >> size; ptr = new char[size];
Debug#1
int main() { char* ptr; int size; cout << "Enter the size of the sentence: "; cin >> size;
ptr = new char[size];
char* ptr2 = ptr; cout << static_cast
for (int i = 0; i < size; i++) { cout << *(ptr2 + i); }
for (int i = 0; i < size - 1; i++) { ptr2++; } cout << endl << static_cast
for (int i = 0; i < size; i++) { cout << *ptr2; } //cout << *ptr2 << endl;
cout << endl << static_cast
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
