I started working with MIPS a couple of months ago and now I need to edit a given string so that it will only display the digits, arithmetic symbols and parenthesis that were in the original string as output. I though I could go ahead an print every string that was a digits, arithmetic symbols and parenthesis with beq instructions and do nothing if it was not. However, I'm supposed to print only when I reach an arithmetic symbol.
I was also given a print function that will print a given string, character by character. I can't change this function.
For example, "17+42/1638a" as input is supposed to give the following output:
In main, original formula: 17+42/1638a
In main, cleaned formula: 17+42/1638
How can I create a string of variable length in the middle of a function, so I can pass it to the printing function.