I'm writing a program that prints out each digit of an entered (integer) number, and stores each digit in an array. I have two functions, main and another function that does the calculations itself. The program needs to cut off ( / 10) each digit in the number and save it seperately so it can all be printed at the end, but to do that it needs to know how many digits (actual filled out digits, not just index...... I think) are in the array, which I assume requires a loop that cuts off every digit and makes another counting variable go up- but what would be the condition, since to do that the correct number of times you would need to know how many digits are in the array!

My current code is:

If I am understanding anything wrong please tell me, I don't have a good understanding of the problem in the first place. Also I know my main function is correct, there are no problems with it. It's something in my understanding of the problem.Code:#include <iostream> #include <iomanip> #include <cmath> using namespace std; int explode(int number, int array[]) { int store = 0; for(int i = 0; i < array[10]; i++) { cin >> array[i]; store = array[i]; } } int main() { int digits[10]; int numdigits; int n; cout << "Enter number: "; cin >> n; numdigits = explode(n,digits); cout << "[" << digits[0]; for( int i = 1; i < numdigits; i++ ) cout << "," << digits[i]; cout << "]" << endl; }