3D array
-
int a [2][2][2] = { { {0,0}, {0,0} }, { {0,0}, {0,0} } );
or...
int a [9][7][5];
initialise (a,9,7,5);...
void initialise (int ***a, int n1, int n2, int n3)
{
int i,j,k;
for (i = 0; i < n1; i++)
{
for (j = 0; j < n2; j++)
{
for (k = 0; k < n2; k++)
{
a [n1][n2][n3] = 97;
}
}
}
}Tada! Note I initialise to 97. You hopefuly know more about what you want to do than I do, and can do things better. If not, go back to bed - you'll achieve more. Iain.
-
int a [2][2][2] = { { {0,0}, {0,0} }, { {0,0}, {0,0} } );
or...
int a [9][7][5];
initialise (a,9,7,5);...
void initialise (int ***a, int n1, int n2, int n3)
{
int i,j,k;
for (i = 0; i < n1; i++)
{
for (j = 0; j < n2; j++)
{
for (k = 0; k < n2; k++)
{
a [n1][n2][n3] = 97;
}
}
}
}Tada! Note I initialise to 97. You hopefuly know more about what you want to do than I do, and can do things better. If not, go back to bed - you'll achieve more. Iain.
-
int a [2][2][2] = { { {0,0}, {0,0} }, { {0,0}, {0,0} } );
or...
int a [9][7][5];
initialise (a,9,7,5);...
void initialise (int ***a, int n1, int n2, int n3)
{
int i,j,k;
for (i = 0; i < n1; i++)
{
for (j = 0; j < n2; j++)
{
for (k = 0; k < n2; k++)
{
a [n1][n2][n3] = 97;
}
}
}
}Tada! Note I initialise to 97. You hopefuly know more about what you want to do than I do, and can do things better. If not, go back to bed - you'll achieve more. Iain.
Nah...
Iain Clarke wrote:
for (k = 0; k < n2; k++)
should be
for (k = 0; k < n3; k++)
Iain Clarke wrote:
a [n1][n2][n3] = 97;
should be
a [i][j][k] = 97;
Did you disable the error checking feature of your mental compiler? ;P Please don't blame me, remeber: "this is going on my arrogant..." :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Nah...
Iain Clarke wrote:
for (k = 0; k < n2; k++)
should be
for (k = 0; k < n3; k++)
Iain Clarke wrote:
a [n1][n2][n3] = 97;
should be
a [i][j][k] = 97;
Did you disable the error checking feature of your mental compiler? ;P Please don't blame me, remeber: "this is going on my arrogant..." :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi CPallini, I have not disabled my mental compiler, i understood, thats a typo error.So i corrected it from my side, without mentioning it.. Thanks & Regards, KDevloper
Beacause you're a fair, kind man. On the other hand, I've arrogant assumptions... :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Nah...
Iain Clarke wrote:
for (k = 0; k < n2; k++)
should be
for (k = 0; k < n3; k++)
Iain Clarke wrote:
a [n1][n2][n3] = 97;
should be
a [i][j][k] = 97;
Did you disable the error checking feature of your mental compiler? ;P Please don't blame me, remeber: "this is going on my arrogant..." :-D
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]I see KDeveloper is more generous of spirit than you. :(( I will now go away and sulk for at least 10 seconds. Not that I'd let you make a typo and get away with it either! :cool: Iain.
-
Beacause you're a fair, kind man. On the other hand, I've arrogant assumptions... :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I see KDeveloper is more generous of spirit than you. :(( I will now go away and sulk for at least 10 seconds. Not that I'd let you make a typo and get away with it either! :cool: Iain.
Iain Clarke wrote:
Not that I'd let you make a typo and get away with it either!
Nah, you're just too kind and fair, like KDeveloper. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Beacause you're a fair, kind man. On the other hand, I've arrogant assumptions... :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]CPallini wrote:
I've arrogant assumptions...
But then I may have a superb reason...
It is a crappy thing, but it's life -^ Carlo Pallini
-
CPallini wrote:
I've arrogant assumptions...
But then I may have a superb reason...
It is a crappy thing, but it's life -^ Carlo Pallini
Yes. :-D BTW I really love that Iain's sentence. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]