03.12.2016, 00:08
Quote:
You can use valstr to convert an integer to a string.
"new digit" should be out of the loop the function is just ridiculous |
However, if we're at this subject, then your function is not that bright, too:
- you don't check anywhere if array used to store the counter is large enough
- function would return invalid results for negative numbers
- instead of creating a 2 cell string, copying every character to that string, and then converting it to a number, you could have done something like this instead: "array[(string[i]-'0')] ++;"
- should I bring into discussion the differencies between pre- and post- increments? nah
So, why is my function ridiculous?