Troubles with nested ifs and bools

Ok so I have plenty of experience with nested ifs and bool values but for some reason, I'm not getting my code to do what I want it to. It's driving me crazy so I'm going to post it here. Can anyone tell me why when I run the program, I can't get my compiler to go inside the if statement (I commented where):
1
2
3
4
5
6
7
8
9
10
11
12
	if(whichWay == right){ // whichWay DOES equal right
		bool x = canJump(fromRow,fromCol,whichWay); // DOES return true
		if(x){ // It skips this if statement...
			peg[fromRow][fromCol] == '.';
			peg[fromRow][fromCol + 2] == '*';
			peg[fromRow][fromCol + 1] == '.';
		}
		else{
		//	throw out_of_range("Out of range");
		}
	}


I've even tried changing x to true just to ensure that I'm giving it true.


EDIT: Ok, I found out after putting a simple cout << "IM TRUE" statement in my glitchy if statement that it wasn't stepping in because the function couldn't deal with the peg array I have. How would I change something in my privately declared: PegType ** peg;
Last edited on
1, where is the PegType originally declared?
2, where is the pasted codes in? I mean it's a public function, or a method of a class, or somewhere else?

A way to find out why is go gdb your code, debug those line step by step to find out whether peg here is a real referred object or not.

b2ee
Topic archived. No new replies allowed.