[c]Storing values into an array
I have a problem, and I'm not sure how to begin.
The problem I have is to write a function that asks a user to enter an integer, then output the number of times a digit appears.
So my ouput looks like this:
Enter an integer: 1034029
The sign : +
The counts of digits:
0 2
1 1
2 1
3 1
4 1
5 0
6 0
7 0
8 0
9 1
Since this problem looks similar to the last problem I had, and posted in another thread, I guess what I was thinking of doing is storing the user inputed integer into an array, after that's done everything else should be just like the problem in the other thread.
What would be the best way of storing the values into an array. Should I create a loop to store the values, and once a return value '\0' is entered it stops, or should I use gets? Or is there a better way of doing this?
|