Hi guys, I am still new to using headers etc and keeping different classes and functions within different files. Basically, I thought that whenever you include "anotherfile.h" it is as if the function / classes within it are in the main file?
So if I have a few variables etc int a = 0, int b = 5 in the main file and I say whenever I want to call the function, change a and b (without having to make the file a int because i want to change many values, how do it do it.
This is becoming more of a beginners c++ question, but I have tried passing string squareFilled[200][100] to the floor function but my compiler is just coming back with tons of errors. :/ How would you pass a two dimensional array?
You have to add the array parameter to the function. void floor(string squareFilled[200][100]);
You don't actually need to specify the first dimension. void floor(string squareFilled[][100]);
or it could be written like this void floor(string (*squareFilled)[100]);
All three ways will work exactly the same. The first two might look easier but the third more clearly shows that what is actually being passed is a pointer.
Another way to do it is to pass it by reference void floor(string (&squareFilled)[200][100]);
When you call the function you pass the object as normal: levelZeroObject.floor(squareFilled);