A couple of Questions

Question 1: Is there any way to make an array in an array.
For example if I had int array1[5];, would it be possible to have array1[2] as another array. Hope it is not too confusing.

Question 2: Is there any way to declare a variable in a functions but still have it a global variable?

EDIT: Also another question: What is the difference between Visual C++ and normal c++, or is there any difference?

Last edited on
1: You mean have an array where each element is an array? That would look like this:

int array[5][10];

Here, array is a const pointer to an array of 5 const pointers, each of which points to an array of 10 ints. Thus, array[2] is an array of 10 integers, and array[2][6] is the 7th element of this array.

2: The scope of a variable is defined based on where you declare it. So a variable declared inside a function is visible only inside that function, a variable declared inside a loop is only available inside that loop, etc. If you want your whole program to see a variable, you need to declare it in the file.

3: Visual C++ is just a compiler - if written correctly, your code should work everywhere. I do think Microsoft allows a few things that standard compilers don't allow, like you are allowed to use void main() (but you never should. ever.)
Okay, thanks.
The reason I bumped this is because I think there are too many threads here and it is very cluttered and unorganized, so I didn't want to crease a new thread.

Another question: Is there anyway to access the clipboard with c++(using Dev-cpp)? If so, how? Thanks in advance - because I may forget to thank you later.
Topic archived. No new replies allowed.