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

Help with ORDER BY
Hello. I would like to order by ascending States, then Cities, then Gyms in the following code, but

Problem with Sending Mail by PHP
hello all,
I m new to php, can u plz provide me the code to send mail by php having CAPTC

Pro-rata Billing in Periodic Billing for Rental
Hi guys,

We have a situation, where a rental contract starts at the mid of the month say

Form File Upload
I've read through tons of resources and tutorials and as far as I can tell, my code is accurate, but

Auto fill in input value based on User_ID
Hello,

I'm looking form some input on the following problem.

User loads page ->

connect() succeeds but accept() does not?
Please help me with this problem. I'm working on a time-sensitive project where I'm using TCP socket

A WBS element with the name XXX already exists in version FREI_VERSION
Hi.
When I am trying to insert WBS element in a project, error occurs:

"A WBS eleme

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

switch not getting value
what am i doing wrong?
i want to populate the country list according to the category
i want to

Generate multilayered array from string.
ok so i have a string that looks like this:
Code: blog:edit_all,delete_all|users:edit_all,delete_

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