Honestly. I was reading a stackexchange thread on EE to help me understand a question on my homework. Half the responses were "why bother posting you're clearly a newb"
At the very least lay out the answer. I fully get "I don't want to help you cheat" but if you have a question like "How do I reverse a string?" You CAN answer the question without making it copy and pastable.
"Go through the string to get the length of the string, or use Strlen() Then use a for loop to cycle between 0 to half the length. For each value, exchange the string pointer + integer with string pointer + length - integer. Now you should have a reversed string" should be a good answer.
I've left a few minor issues and a few optimizations as well as edge cases in there as well, I answer the question but still leave the OP the challenge of coding it and improving it, and testing it.
Pretty off topic here, but why did you do the revered string like that? I'm still learning, but I've reversed strings by creating a new string then using for (i=string.length(); i>0; i--) and within the loop adding the current character to the end of the new string. I made it into a method so I haven't bothered to redo it in a different way since.
213
u/InfernoForged Feb 05 '18
It's spreading to other stack exchange communities as well. Some of the commenters in electrical engineering are just straight up assholes too.