typedef struct Cell
	{
		int north,south,east,west;
		int RD;
		bool visited;
	}  Cell_Info;
	
Cell_Info a[100];

this doesnt seem to want to dereference ..when i type a[0]. i get an erorr instead i should have a list of attributes that are instide the structure...Any ideas?

You mean type a[0] like this?

Cell_Info a[0];

???

no i'm trying to get an aray of structures. and then dereferencing them..

There shouldnt be any problem in dereferencing array elements if you use the code you posted. So maybe it is in the code you have not posted. Can you post the code where you actually get the error?

There shouldnt be any problem in dereferencing array elements if you use the code you posted. So maybe it is in the code you have not posted. Can you post the code where you actually get the error?

I was trying to deferencing it as a Global peice of code.

it works in a fuction. Now for my next question...

i have the following lines of code .. they dont work correctly or compile but its just to give you guys an idea of what i need / would like...

typedef struct Cell
	{
		int north, south,east,west;
		int RD;
		bool visited;
	}  Cell_Info;
	
Cell_Info a[10];

typedef struct Row
{
	Cell_Info a[10];
}Rows;

typedef struct Cols
{
	Rows r[10];
}

Basically Cell_info is 6 attrbutes of a particar cell located on the map. Now that map contains rows and cols.

so in order to access a cell in a row i'll need 2 peices of info..the row and cols

so r.c would give me a cell ...any ideas of how to get this into code?

would this be the best way? or correct way?

typedef struct Cell
	{
		int north, south,east,west;
		int RD;
		bool visited;
	}  Cell_Info;
	
Cell_Info a[10];

typedef struct Row:public Cell
{
	Cell_Info a[10];
}Rows;

typedef struct Cols:public Row
{
	Rows r[10];
}Data;

Cols D[10];
This article has been dead for over six months. Start a new discussion instead.