Multi dimensional arrays


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

If I put in this code:

1
2
Did you know?Explore Trending and Topic pages for more stories like this.
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

Disable html within defined tags
I have a mysql database that allows users to enter content with html, but I also want to have a tag

POST into Array problem
Hi Chaps,

I have a repeat region, displaying rows of data: jobid, fromtable, translatorcharge

SAP FICO learning materials
Hi all,
I am new to this world of SAP FICO. I have taken training on SAP FICO, but was wonderin

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

Guixt issue
Hello all,

We are experiencing the following problem with Guixt:

Some transact

Will this protect from mysql injection?
I do not want anything like DROP TABLE to work or any type of coding..

Heres my code.. is it

Replacing a string on click of a button
Hi! Is there a way to replace a string on a click of a text link?

This is what I've come up w

split string
Hi all

i have some names (imploded by comma):
Code: toronto,paris,madrid
Now, i would

The type or namespace name 'ServiceModel' does not exist in the namespace 'System'
When I locally run the website, it works just fine, but when I uploaded it to the hosting environmen

Basic Question about Threading and PHP...
I have a page that I am working on and it is taking several hours to process. The basics of what th

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