I am trying to replace a certain character in a string with a space using the following code line:
str[i] = " ";
How can realize this without getting the error in the title of the question?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
use single quotes
In C++, the token
" "is a string literal which represents an array of two characters: the value of a space in the character set (eg, the value 32 in ascii) and a zero. On the other hand, the token' 'represents a single character with the value of a space (usually 32). Note that in C, the token' 'represents an integer with the value of a space. (In C,sizeof ' ' == sizeof(int), while in C++,sizeof ' ' == sizeof(char) == 1.)