#include <vector>
using std::vector;
//declarations:
void initConfig(vector<vector<int> >& prelattice, int nL, int nN);
void warmUp(vector<vector<int> >& prelattice, int nL, int nN, bool inside=true);
int main() {
int nN = 10; //number of columns
int nL = 15; //number of rows
vector<vector<int> > lattice(nL, vector<int>(nN)); //declaration of lattice
initConfig(lattice, nL, nN); //creation of random lattice
warmUp(lattice, nL, nN); //warming up the system
return 0;
}
For some reason I cannot manage to make the function warmUp work. The two functions are compiled and linked to the main program accordingly... no complaints from the compiler. Since I do not get an error message, I am quite lost!
I does not print anything... not even the first std::cout that I placed to check. It seems to me that the function is not being executed at all. All being said, although now the compiler does not return any error message, before it was stating that warmUp was undefined in my main. After I included the default argument in the declaration of the function in main it does not complain... but it does not execute warmUp at all :(. It's sad.
Since I do not get an error message, I am quite lost!
Can you learn to use the debugger - should be quite easy if you are using an IDE. You can step through code 1 line at a time, keep an eye on the values of your variables & deduce where it all went wrong.
Vlad's suggestion is probably easier right now, (I always look forward to reading what he says). But knowing how to use a debugger is an essential skill, and by far the quickest way of solving runtime errors - save yourself days of problems.