473,473 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to define a dynamic 2D array

6 New Member
my professor said one way for declaration dynamic 2d arrays.
Expand|Select|Wrap|Line Numbers
  1. int **a=new int *[m];
  2. int *x=new int[m*n];
  3. int *y=x;
  4. for(int j=0;j<m;j++)
  5. {
  6. a[j]=y;
  7. y+=n;
  8. }
and i never understand this way.like what does y or x in this code.I want a person explain how works this code.if show with a image is better.thanks
Feb 3 '14 #1
1 2028
donbock
2,426 Recognized Expert Top Contributor
Read the Arrays Revealed article. Let us know if you still have questions after that.
Feb 3 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Vasileios Zografos | last post by:
Hello, I have a function that generates some values (e.g. vertices in 2d space) the number of which I dont know. So, it could generate 20 vertices, 100 vertices, or even 1 vertex. void...
0
by: Reed | last post by:
Can someone stear me in the right direction to convert a binary tree from a Linked List to a Dynamic Array... Dynamic arrays aren't something im strong with. //********bintree.h******** #ifndef...
10
by: Russell Mangel | last post by:
I have written the following program using VS2005. The program is a Dynamic Array similar to System.Collections.ArrayList in .NET. The program works okay until I reach 65536, I can't seem to figure...
2
by: him1979 | last post by:
If I have these classes: class student { private: string * name; int faculty number; date datebirth; public: ... };
2
by: zensunni | last post by:
By dynamic, I mean an array that you don't have to define the array size. In PHP, you just go.. array = "whatever" ..and it tacks on another index value. Does this not exist in asp?
4
by: Steph | last post by:
Hello, I have filled a dynamic array of strings (realloc() + malloc()) char **sMyArray; At the end, I get correctly sMyArray = "STRING_0", sMyArray = "STRING_1", etc... But I'm unable to...
11
by: C C++ C++ | last post by:
Hi all, got this interview question please respond. How can you quickly find the number of elements stored in a a) static array b) dynamic array ? Rgrds MA
13
by: kwikius | last post by:
Does anyone know what a C99 dynamic array is, and if it will be useable in C++? regards Andy Little
1
by: lumumba401 | last post by:
Hello everybody, i am asking about how to define a bidimensional dynamic array as a global variable to use as incoming variable in a function Let us see , for example in a part of a programm...
2
rhitam30111985
by: rhitam30111985 | last post by:
Hi all .. i am trying to create a dynamic array in visual basic 6.0 (not .net) Now i know abt redim and all ... but in that we need to know the array size before hand ... what if we want to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.