i want to create a linked list node with a 2d array, how would i initialize its data and the rows/columns?

so say if i had an array in struct

1
2
3
4
5
6
7
8
9
10
11
12
struct node
{
node (array [8] [10]):{int num1, int num2, array [num1] [num2]}//this is where im stumped first
int a;
}
how do i initialize the member selector and also how might i initialize the arrays data?

like this? node1.array [10][10] = {23,231,4124,}

if i do that my compiler shouts at me, how do i do this?





My goal would be to put some ascii art in each node, say i stored the alphabet in the form of a 2d array eg;

--cc--
cc--cc
cc----
cc----
cc--cc
--cc--


would be 'c' then my next job would be to have each linked list initialize another array and be able to add other links onto it lie so;




1
2
3
4
5
--c
cc--cc--hh--------ii--
cc------hh--------ii--
cc------hhhh------ii--
cc--cc--hh--hh----ii--
--cc----hh--hh----ii--


would be chi, can you give me a hint on how you would go about adding this to another 2d array that would be around [6] [80]

i will suss it all out myself if you could hint on how you plan codes in the first place.
Last edited on
cah'maaaaan
You shouldn't double post http://cplusplus.com/forum/general/87051/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <iostream>
struct S
{
	S()
	{
		for(int i = 0; i < 9; ++i)
			for(int j = 0; j < 3; ++j)
				arr[j][i] = i+1;
	}
	int arr[3][9];
};
int main()
{
	S s;
	for(int i = 0; i < 9; ++i)
		for(int j = 0; j < 3; ++j)
			std::cout<<s.arr[j][i]<<std::endl;
}
Last edited on
i thought maybe i posted in the wrong section, but thanks for that i was just trying combinations
Topic archived. No new replies allowed.