Hello,
I want to make dynamic matrix in c++ by using new by I don't know how to define pointers!
5 replies to this topic
#1
Posted 08 January 2011 - 05:20 AM
|
|
|
#2
Posted 08 January 2011 - 05:43 AM
Why not use a std::vector?
#3
Posted 08 January 2011 - 05:49 AM
I can not use vector!
I need sth like * *p;
I don't know how to use it!
I need sth like * *p;
I don't know how to use it!
#4
Posted 08 January 2011 - 08:13 AM
So you need something like a 2d array?
#5
Posted 08 January 2011 - 09:28 AM
Hi,
you can define dynamic array like that
I hope this helps!
Munir
you can define dynamic array like that
int rows = 6; //this is an example this can have any value;
int column = 6;
int **DynamicMatrix = new int*[rows]; //we are going to create an integer dynamic matrix
//The above statement creates memory for rows
//the following statement creates memory for column for each row!
for (int i = 0; i < rows; i++)
{
DynamicMatrix[i] = new int[columns];
}
I hope this helps!
Munir
#6
Posted 08 January 2011 - 09:36 AM
Yes 2ed array.
Thanks!
Thanks!
mnirahd said:
Hi,
you can define dynamic array like that
I hope this helps!
Munir
you can define dynamic array like that
int rows = 6; //this is an example this can have any value;
int column = 6;
int **DynamicMatrix = new int*[rows]; //we are going to create an integer dynamic matrix
//The above statement creates memory for rows
//the following statement creates memory for column for each row!
for (int i = 0; i < rows; i++)
{
DynamicMatrix[i] = new int[columns];
}
I hope this helps!
Munir
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









