I have a function declared something like
void func1(int& x) {
func2(x); // func2 accepts an int
}
I think this is what crashes the program? I get the error
R6010 - abort() has been called
What do I need to do to pass x into a function that accepts an int? I expected them to work the same … since I can just echo the value of x using cout << x
UPDATE
Just a test:
cout << stmtNo << endl;
Node* n = ast->getNode(stmtNo);
cout << n->getNodeType() << " " << n->getStmtNo() << endl;
Above fails … Below passes
cout << stmtNo << endl;
Node* n = ast->getNode(1);
cout << n->getNodeType() << " " << n->getStmtNo() << endl;
There is no problem, you can always pass an integer reference as an argument for an integer.
Integer references can be interpreted as constant pointers who automatically de-reference themselves.
The above code works perfectly!