I want to declare and initialize one of two variables, depending on certain conditions that depend on the user. The only way I know how to do this is using IF. The problem is, I want the variable to be used outside of the IF function, which is not possible due to the scope of the variable.
Specifically, I have a 2D array, representing a table. The sizes of the array are input by the user, and I need to add either additional rows or additional columns such that the array is of the same size for both indices. I have global variables for the user input, and I need the added rows or added columns to be a new global variable. They cannot be stored in the same variable either, as further calculations will vary depending on which one is present.
EDIT: My college prof said uninitialized variables don't consume memory, which this stackoverflow Q says is not true. I guess deleting unwanted variables during runtime seems to be the best option, though I don't know how to do that.