1. The only rule is that you must define it before it is used. So that can be on the line immediately before the myArray declaration, or before the class class_name, or in a different header that is #included by this header or your C file, or #included by another header that itself is #included from another header or your C file, or in your main C file before you #include this header.
2. You need additional lines of the form "struct struct_name variable_name", then if you have class_name X, you can reference myArray with X.variable_name.myArray. struct struct_name { /* contents */ }; only defines a new type struct_name, it does not declare any variables.
3. No, array dimensions must be constant. If you need variable size arrays whose size is not known until runtime (and you don't want to use a fixed size array with a count of how many items are in it, and of course an upper limit of how many items you can stuff into it), you need to use pointers and new/malloc, which sounds complicated but in reality is very easy, For example:
Code:
int *dynArray=0;
int arrsize;
cout<<"Enter size : ";
cin>>arrsize;
dynArray=new int[arrsize];
// you can now access dynArray with static array syntax, for example:
dynArray[5]=27; // assuming arrsize>5, of course, so always check you don't write to memory after arrsize unless you want your program to suffer from some really nasty bugs
cout<<"dynArray[5] contains " << dynArry[5] << endl;
// after you've finished with dynArray, do this to prevent memory leaks:
delete[] dynArray;
dynArray=0;
Initialising dynArray to zero and setting it to zero after delete[]ing it is a good way of avoiding some very nasty bugs.