View Single Post
  #5   Spotlight this post!  
Unread 28-03-2004, 17:51
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: More automonous help:ending stuff

I think you'll need to declare that int as 'static' -- otherwise it won't be remembered from one cycle to the next:

Code:
static int count = 0;
Also, if you want to declare it in one place and increment it in another you will need to declare it as global, which means outside of all functions:

Code:
// this is global:
static int count = 0;

User_Initialization()
{
  static int anotherCount = 0;  // this is local to this function, 
                                         // and cannot be seen outside of
                                         // this fuction.

  
  count++;  // okay
  anotherCount++;  // okay
  
}

anotherFunctionInTheSameFile()
{
  count++;  // okay -- it's global
  anotherCount++;  // won't compile
}
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.