How do I get -> to work?

Hey,
I have a struct .h file, another h file and a .cpp file with my main method. I am trying to make a list using the data type I created in my struct file, but it is not recognizing -> and keeps throwing error:

OrthogonalLinkedSparseMatrix.h:46: error: base operand of ‘->’ has non-pointer type ‘OrthogonalNode’

where OrthogonalLinkedSparseMatrix.h is my implementation header file and OrthogonalNode is my struct class.

OrthLinkedSparseMatrix has code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
	//CONSTRUCTOR
	OrthogonalLinkedSparseMatrix(int r, int c, int v)
	{
		rows= r;
		cols= c;
		TotValues= v;
	}
	
	OrthogonalLinkedSparseMatrix() {};
	
	//Insert values into Matrix
/*void insert(int r, int c, int v)
	{
		OrthogonalNode newnode;
		newnode->row = r;
		newnode->col = c;
		newnode->value = v;
		newnode->right = NULL;
		newnode->down= NULL;
	}
	*/
	
	void createList(int r, int c, int v)
	{
		if(rowList->down == NULL)
		{
			
		}
		
	}
	
	 OrthogonalNode rowList;
	 OrthogonalNode colList;
	
	//void transpose(OrthogonalLinkedSparseMatrix &b);
	//void add(OrthogonalLinkedSparseMatrix &b, OrthogonalLinkedSparseMatrix &c); 

private:
	int rows;    // number of rows in matrix
	int cols;		 // number of columns in matrix
	int TotValues;


and the struct program has
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
#ifndef OrthogonalNode_
#define OrthogonalNode_
//#include "OrthHeaderNode.h"

//no template class. Can only use integers
struct OrthogonalNode
{
	// data members
	 int value;
	 int row;
	 int col;
	 OrthogonalNode *right;
	 OrthogonalNode *down;
};
#endif 

Why won't it let me use -> ???
Thank you

Maybe because you commented it out - nah only joking - is it a pointer? the -> dereference a pointer it would be kind of like #

(*)newnode.row = r;

new node has to be initialized as a pointer to be able to use the -> tool.
Topic archived. No new replies allowed.