help with arrays

Pages: 12
need to know how to do some thing like this example

 
  n[x]
try Google.
n[x]
There ya go
im doing this in setpixel and it doesn't work
array space must be const
you are providing a variable for array size..it must be some constant
it cant be a constant it needs to change I,m using a while loop to draw different squares in different areas
its against the syntax of arrays dear
Try dynamic memory
Then use a std::vector or some other STL container. Your question is very vague.
http://www.cplusplus.com/reference/vector/vector/
http://www.cplusplus.com/forum/beginner/1601/

hope it helps...same question
so is there anything else I could do I tried a vector but I couldn't declare it right
what compiler are u using
vc++ 2010
How did you try to declare it?
vector<int> x (4);
u can do it by creating dynamic array like this
int* array = new int [ x ];
so like int* array = x [4]
int* a = NULL; // Pointer to int, initialize to nothing.
int n; // Size needed for array
cin >> n; // Read in the size
a = new int[n]; // Allocate n ints and save ptr in a.
for (int i=0; i<n; i++) {
a[i] = 0; // Initialize all elements to zero.
}
. . . // Use a as a normal array
delete [] a; // When done, free memory pointed to by a.
a = NULL; // Clear a to prevent using invalid memory reference.


here is a complete solution to ur question
vector<int> x (4);
looks fine, what errors did you get?
Pages: 12