The way you would do your sample code in arrays looks like this: [code] int array[4]; int intRandom = 1234; array[0] = intRandom / 1000 % 10; array[1] = intRandom / 100 % 10; array[2] = intRandom / 10 % 10; array[3] = intRandom % 10; [/code] I defined the array length to 4 integers because you're only processing four digits. As you may know, integers can have more digits than 4, but I'm just following your example code. You might have already learned that C++ arrays start at index 0. That's why the first digit is being placed in array[0]. Compile this and go into debug-mode to view the variables. If you have a good debugger, you'll see that array[0] is 1, array[1] is 2, array[2] is 3 and array[3] is 4. You can try to display your array to the screen. One way you might try looks like this (but warning -- it will not do what you want it to do): [code] #include int main(int argc, char* argv[]) { int array[4]; int intRandom = 1234 array[0] = intRandom / 1000 % 10; array[1] = intRandom / 100 % 10; array[2] = intRandom / 10 % 10; array[3] = intRandom % 10; std::cout << array << std::endl; return 0; } [/code] Output: 1245048 Your output number might be a little different. So what's going on? Why was it broken? Because, the << operator is displaying the ADDRESS of the array, not the contents of the array. In your debugger, you might see the address of the array in hexidecimal, like this: 0x0012FF78. That value is the same as 1245048 in decimal. If you want to see each digit, one way you could do it is like this: [code] for(int i = 0; i < sizeof(array) / sizeof(int); ++i) { std::cout << array[i] << std::endl; } [/code] All of this isn't directly answering your question but it's leading up to my answer for your question. One way that you can assign a number directly to an array and have each digit placed automatically in each position of the array is to use the library function sprintf. Here's an example: [code] #include #include int main(int, char**) { char buffer[6]; int intRandom = 1234; sprintf(buffer, "%d", intRandom); for(int i = 0; i < sizeof(buffer) / sizeof(char); ++i) { std::cout << buffer[i] << std::endl; } return 0; } [/code] I changed the array to buffer so we can distinguish between this example and the previous one. I changed the type of the buffer from int to char because sprintf wants a character array. I also changed the length from 4 to 6 (I'll explain this later). I also changed the for-loop to use sizeof(char) instead of sizeof(int) because the buffer is of type char. The output is close to what you think it should be but it's for the wrong reason. Here's the output: 1 2 3 4 (blank line) (blank line) The '1' being output is actually the character 1, not the digit 1. The << operator is displaying each digit of the array (called buffer) and since the array is of type char, it's displaying characters instead of digits. Your debugger will show you the actual values in the array: 49, 50, 51, 52, 0, 0. The first 0 was put there by sprintf to terminate the character array. The second 0 might be some other value depending on your compiler. The actual values inside the array can be displayed like this: [code] for(int i = 0; i < sizeof(buffer) / sizeof(char); ++i) { std::cout << static_cast(buffer[i]) << std::endl; } [/code] If you really want to see the values of 1,2,3,4 in your array, you'll need to subtract '0' from each array character, like this: [code] int numDigits = strlen(buffer); for(int i = 0; i < numDigits; ++i) { if (buffer[i] >= '0') buffer[i] = buffer[i] - '0'; } for(int i = 0; i < numDigits; ++i) { std::cout << static_cast(buffer[i]) << std::endl; } [/code] I used strlen to get the number of digits in the buffer. Then I subtracted '0' from each digit and displayed the buffer the same way as I did before (but only displaying the number of digits that are valid in the buffer). The result is what you think it should be: 1 2 3 4 This works okay for positive numbers. Try using a negative number and see what happens. Warning: use numbers that are four digits or less. If you want to change the array to handle any integer, you need to find out the maximum number of digits for an integer on your compiler. I changed the size of the array to allow space for a negative sign, the four digits in your example, and a trailing null character (the value of a null character is 0). Hope this helps. cdk