# Thread: Arrays and the POINT structure

1. ## Arrays and the POINT structure

Ok some of you might know that I have Sams Teach Yourself C++ in 21 days. So I you know read what they had on arrays, but then (which is not a whole lot) so now I am reading Programming Windows by Petzold......I stumbled upon this......

POINT apt[5] = { 100, 100, 200, 100, 200, 200, 100, 200, 100, 100 } ;

it says an array of five but then it has 10 elements, so I am guessing this is because it's part of a POINT structure which is a pair of values.........am I at least on the right track? Please reply ASAP I need this to go on.

2. im thinking your assumption is right?

3. WOHOOOOOOOOOO you wouldn't imagine how many times I refreshed this page............. thanks

4. I'm a new commer, I hope everbody will help me more. Now, i'm learning C++ programing, and i'm afraid with pointer very much, i have read Sams Teach Yourself C++ in 21 days but sometimes i don't understand too much about pointer, someone can help me?

5. Best guess: You're looking at a "window/rectangle". (Check the values against the coordinates of a rectangle.)

In short, they're x,y coordinates.

May explain why the initialization of the "array" is mirror-image of itself.

(Note how the last pair of values match the first.)

I'm not a "windows" programmer, but try to find out how POINT is defined. May give you a clue.

(I'm not breaking any new ground here, am I? )

-Skipper

P.S. Where, in the world, did all of the superfluous postings come in?

6. POINT and pointer are quite different. POINT is a structure defined in one of the windows header files. It contains two variables that represent an x location and a y location.

A pointer is simply a memory address. For example, look at the following code:
Code:
```int *pnum;//declares a pointer
int number;//declares an int
number=4;//sets number equal to 4
pnum=&number;//makes pnum 'point' to number
cout<<number //outputs 4
<<endl<<*pnum //outputs a new line then 4 because 4 is the value stored at the address of number
<<endl<<pnum; //outputs a new line then the memory address

number=6;
cout<<number<<endl<<*pnum;  //outputs 6 twice because pnum points to number;```
Basically, to get the value at the address, you use the * (dereference operator). To get the actual memory address, you leave out the *.

7. Code:
```typedef struct tagPOINT
{
LONG  x;
LONG  y;
} POINT, *PPOINT, NEAR *NPPOINT, FAR *LPPOINT;```

8. Golfinguy4,

As I said, not a "windows" programmer. (Could you tell?) Thanks for the clarification. Good info.

Hershlag,

Guess that's what I was, sort of, expecting to see pop up. Thanks.

-Skipper

(P.S. This is Elchulo's post and I'm thanking everyone . Well, darn it, I appreciate the input!)

9. wow!!! that room is interesting!!!!
thanks a lot tutors, i've just learnt about C++ , i think that room is good for me, thanks a lots

10. sorry i have a exercise like that, as i know with this exercise i must use about 4 times 'for condition'. but when i write i can't find the way to solve it, some one can help me:

Write a program that reads a character string & prints out each word in a separate line. A word consist of consecutive characters delimeted by spaces or the beginning or the end of the string.
thanks , i don't need you write for me a code but i want to know , if i don't use that way how i can do another way???
please explain for me the way you solve

11. Thanks guys for the help.

12. Look up the function strtok.