Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Define array C++

Author
Message
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 28th Nov 2015 12:22 Edited at: 28th Nov 2015 13:16
I have searched a lot for how to declare arrays in C++, but I still come up empty handed :-(

I would like to know: How to define a multidimensional array, how to assign a value to a spot in a multidimensional array.

I have this:


I have also tried things like calculated_path as int[1][1].

Using the documentation for AppGameKit Tier 2 does not help, it wont compile using those instructions. I searched for a lot of C++ help, but it still wont compile using the help I get on the net :-P

EDIT: AHA! You cannot assign data to variables and arrays outside loop/functions and the likes
The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
Cybermind
Valued Member
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 29th Nov 2015 18:43
Got it

It seems that the constants have to be declared together with the identifier name (here obstacle_map, allocated dynamically with *), and the dynamic values are grouped together (x and y are dynamic variables, not constants). I am open for correction if I got anything wrong here

int (*obstacle_map) [4] = new int [x,y] [4];
The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...

Login to post a reply

Server time is: 2024-04-24 13:21:22
Your offset time is: 2024-04-24 13:21:22