0
Function to return string of items pulled from other string
I want to create an array of the characters that represent operations in the below code but can’t seem to get it to work. Anyone tell me what I’m missing? https://code.sololearn.com/c6uUfZM6asYO/?ref=app
3 Respostas
+ 3
Need a second variable <j>, for indexing in <symbolsArray>, use of <i> in your code makes the characters from <input> be copied into undesired position.
for (int i = 0, j = 0; i < strlen(input); i++)
{
if (input[i] == '+' || input[i] == '-' || input[i] == '*' || input[i] == '/')
{
symbolsArray[j++] = input[i];
}
else
{
continue;
}
}
+ 3
You're welcome, don't we all make mistakes? yes, it's fine 👌
+ 1
djuh on my part. simple mistake. tjanks for catching!