swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

static vars


From: donalson
Subject: static vars
Date: Sat, 26 Sep 1998 18:17:32 -0700

Am I confused about "static" in objective C?

If I define a method

input
{
int new[20];
static int old[20];

    for(i=0; i<20;i++)
       fscanf(whatever,"%d",&new[i]);
   //do something with new and old here
   for(i=0; i<20;i++)
      old[i]=new[i];
}
I thought that static meant that when the method was used, "old" would
contain the previous values of "new".  It is not happening.  Am I
missing something obvious?

Cheers (sort of),

D3

--
*********************************************************************
* Doug Donalson                 Office: (805) 893-2962
* Ecology, Evolution,           Home:   (805) 961-4447
* and Marine Biology            email address@hidden
* UC Santa Barbara
* Santa Barbara Ca. 93106
*********************************************************************
*
*   The most exciting phrase to hear in science, the one that
*   heralds new discoveries, is not "EUREKA" (I have found it) but
*   "That's funny ...?"
*
*       Isaac Asimov
*
*********************************************************************



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]