View Single Post
Newbie Member
19Apr2012,10:41  
kris10's Avatar
Alright I am new to c++ so this may be fairly obvious, but bear with me.

I have to define structures within a class, and arrays with constant variables as arguments. I have something like this so far:

Code:
class class_name
{
public:
    struct struct_name
        {
            int myArray[CONST_VARIABLE];
         };
in my .h file
Questions:
  • Where do I declare the constant variables such that they can be used in the main( ) function, and each object of my class_name?
  • How/where do I declare an instance of struct_name such that I can access and input the different parts in a function in my main.cpp file?
  • Can I declare an array with a variable in the [] that is not constant? (I don't know what [] is called) In other words, can I have arrayName[variable] where the value of [variable] changes throughout the program?