Runtime error with space character removing function
This function is causing the program to crash, but I can't spot my error.
Any ideas for what is wrong with the function?
Code:
string removeSpaces (string input)
{
string output;
int n;
int o = 0;
for ( n = 0; n < (int)input.length(); n++ )
{
if (input[n] != ' ')
{
output[o] = input[n];
o++;
}
}
return output;
}
