# Thread: Displaying an array (concept not a how to)

1. ## Displaying an array (concept not a how to)

The other day I decided to start a program that solves soduku puzzles on the account that I had just learned C++ and I thought it would be a good "out of the books" exercise. While writing some pseudocode I got bored and decided to run the following code to see what happens:
Code:
#include <iostream>
using namespace std;

int main(){
int sudoku[10][10];
cout<< sudoku;
cin.ignore();
return 0;
}
When I ran the program I got this:
0x22fde0

Can someone tell me what that means? The curiosity will kill me if I don't find out.

2. sudoku is an array. When you attempt to output an array, the variable name (sudoku) is considered to be a pointer to the first element. The pointer value is output. Pointers are output in hex format, and so that is what was printed.

You'd have to write extra code to display each value in the array (which of course is not yet initialized).

3. So im assuming that the number I got was the memory address then?

EDIT: wait what does the "0x" mean? 0 times that hex number?

4. yes, that's the memory address, and 0x denotes a hex number. for example, 0x5 is hex 5.

5. You must use a loop (for or while) that will iterate through each element

6. EDIT: wait what does the "0x" mean? 0 times that hex number?
We have to have some way of notifying each other what base a number is represented in. By convention, a number like:

16

is considered a decimal number. You could write that decimal number in hex like this:

10

but how do other people, and especially computers, know that should be considered a hex number and not decimal number? To signal that a number is represented in hex, you prefix it with "0x":

0x10