Multi dimensional arrays


Posted on 16th Feb 2014 07:03 pm by admin

If I put in this code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include using namespace std; int place[10][10] = {{0,1,2,3,4,5,6,7,8,9},{9,8,7,6,5,4,3,2,1,0}}; int i; int main(){ for(i=0; i<10; i++){ cout << i << endl; cout << place[i][i] << endl; cout << place[i][i] << endl; cout << "n" << endl; } }

I get:

0 1 2 3 4 5 6 7 8 9 0 8 0 0 0 0 0 0 0 0 0 8 0 0 0 0 0 0 0 0

When I want to get:

0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 9 8 7 6 5 4 3 2 1 0

So how would I correctly define the array? Also it returns no errors and it was compiled with GCC.

No comments posted yet

Your Answer:

Login to answer
204 Like 10 Dislike
Previous forums Next forums
Other forums

Calling strings from other php class
I have test1.php{
$string1;
$string2;
....
... //10 strings in this class <

present value of sequence?
Hi

Please help me to find out the present value of sequence?

Thanks

PHP Login
Hey!
I got this shopcart code online, am trying to modify it but am getting an error when i try a

HTML Form Server Side Validation
Hi, Im new here, im currently doing a website for a friend, and I have designed using snippets from

Need understanding of this bit of code
Code: <?php
// WHERE clause filters
$arrSQLFilters = array();

//

Simple Scraper... Weird Output
Okay, maybe I just need a Blue Monster and some sleep, but....

I'm scraping a ringtone site

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

mail()
Hi all. I have a problem with emails. I am trying to set up a mail system where customers can subscr

Remove letter from numeric textbox
I have a textbox that will search the employee database by entering in the employee ID and it will r

parsing error
can anyone explain this syntax error:

Parse error: syntax error, unexpected T_IF

The e

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash