I am facing this position where I need to create a dynamic string of user-inputted size (so I tried used a dynamic cstring).
char * S;
int x;
cin >> x;
S = new char[x];
for (int i = 0; i < x; i++) {
S[i]=' '; //trying to make it a string of spaces so I can fill it in later
}
upon doing this and outputting the string (cout << S;)
I am getting x spaces and some random characters how do I solve this?