#include <iostream>

using namespace std;

int main() {
int list[12] = {8,1,11,4,2,9,10,5,3,12,6,7};
cout<<list;
return 0;
}

I run the above code and get this:

0x22fef0Press any key to continue . . .

Please help!!!

New with C and new with Dev-C++ which my University wants us to use...

Running from Windows 7
Dev-C++ 4.9.8.3
MinGW compiler

Recommended Answers

All 2 Replies

cout
doesnt recognise arrays so you are outputting a pointer what you wanted to do is

#include <iostream>
int main() {
  int list[12] = {8,1,11,4,2,9,10,5,3,12,6,7};
//can go faster but this is easiest to read
for(int j =0 ; j < 12; ++j)
{
 std::cout<<list[j] << " ";
}  
//output a new line
std::cout << std::endl;
return 0;
}
commented: Thanks!! Great fast accurate answer! +0

Its an integer array pal .
The right way to print is to put it inside a for/while loop .

for ( int i= 0;i <12 ; i++)
cout<< list[i];
commented: :-) thanks learnt something tonight!! +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.