help with arrays

Pages: 12
Don't use dynamic memory.

Just use a vector.

std::vector<int> iVec;

Then just iVec.push_back(element); to add to it.
ill just show you the while loop please explain it to me from there

while (count > 4)
{
SetPixel(hdc, 0 + x[count], 0 + y[count], c);
count --;
}
What exactly are you trying to do? That just looks like your accessing a couple arrays.
I am it wont work im trying to have a variable declare a position in an array in a setpixel function
What error are you getting?
expression must have a pointer-to-object type
That doesn't sound like an error applying that snippet.
it is saying it about x[count]
And how is x declared?
int x [4];
Well first off your accessing memory outside of that array. From your loop, I assume count starts off >= 4?
Last edited on
what
klay2 wrote:
while (count > 4)
{
SetPixel(hdc, 0 + x[count], 0 + y[count], c);
count --;

So if it is out of range then access that item? doesn't make much sense what are you trying to do/accomplish?
Topic archived. No new replies allowed.
Pages: 12