If I had a variable int traps[] defined in main(), passed by argument to another function, lets say play(traps) and then a separate call to another function layTraps() within the play() function - would I have to pass the traps variable via argument to layTraps() from play() or since the function layTraps() is within the function play() who already has access to traps[] variable, then by inheritance, layTraps() would have access to it??
Calling functions has absolutely nothing to do with inheritance, so any function you call will need variables it needs passed to it. It doesn't seem you are using classes at all, so layTraps() gains the variables of play() no more than play() gains the variables of main(); that is, not at all.
Function layTraps() is not within function play(). It is called within play() but defined in some namespace or class. You may not define a function within another function in C/C++.
Ahhhhh I see, its not a function within a function, just a call to a function within another function and that's why the variables scope is not in range. Got it