Integer being display as weird char

Hi all, I have a prob, I store a user input to a variable, and then I display it. however it display weird char instead. Heres the code


int Id[10]

cout << "Enter a Id";
cin >> Id;

cout << Id;

This will display funny char instead of numbers. Need advice
Because iD is an array, not an int.
I will clarify, although this does belong in the beginners section.

1
2
3
4
5
6
7
8
9
10
int a; // Int
int b = 10; // Int with value of 10
int c[10]; // Array of 10 Ints, with invalid values
int d[10] = {0}; // Array of 10 ints, all set to 0

cout << "Enter d[0]: ";
cin >> d[0];

cout << "D[0] = " << d[0] << endl;
just to add to what Zaita has said. ld is not an int, it is a pointer to an array. The character you are seeing is probably the memory address in hex.
Topic archived. No new replies allowed.