char ** ptr = new char *[3];
ptr[0] = new char [5];
ptr[1] = new char [6];
ptr[2] = new char [7];
cout<<"Enter first array: ";
cin.getline(ptr[0], 5);
cin.getline(ptr[1], 6);
cin.getline(ptr[2], 7);
for (int i=0; i<3; i++){
cout<<ptr+i<<endl;
}
for (int i=0; i<3; i++){
delete[] ptr[i];
}
When I run this code, it gives the following output:
Enter first array: name
0xf99c20
0xf99c28
0xf99c30
I actually wanted the user input printed out.
Could someone please tell me how to do this?