> {
> PointType startPoint;
> PointType endPoint;

  try this:

  {
  static PointType startPoint;
  static PointType endPoint;

> Here I get no sounds whatsoever.  Apparently, accessing the variables by
> reference as opposed to by value is ok, but the reverse causes them to be
> reinitialized to zero or something.  I dunno.
> 
> First one to figure this out gets a big prize!

  well.. the reason why it wont work is simple. when you declare
  your "points", you declare them "local". every time the function
  is called, memory is allocated for them :)

  what you essentially are doing by making them "static" is making
  them act like global variables - this way, they keep their value
  even when the function is returned.

  here is a simple example:

---
void boo() 
{
  static int x = 0;
  printf("%d\n", x++);
}

void main()
{
  boo(); boo(); boo();
}
---
  
  result? the numbers 1, 2 and 3 are output on the screen. :)) now,
  think about *how* this happened? and what effects occur when the
  variable is NOT declared static :)

  whats my prize?

  cheers

// az "end of C 101 for today" :P
[EMAIL PROTECTED]
http://www.ardiri.com/    <--- free games!



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to