qc.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
STATIC.C
                                             Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
/* STATIC.C: Demonstrate static variables. */
 
#include <stdio.h>
 
void add_val( int value );
 
main()
{
   add_val( 1 );
   add_val( 5 );
   add_val( 20 );
}
 
void add_val( int value )
{
   static int methuselah;
   if( value == 1 )
      methuselah = 0;
   methuselah = methuselah + value;
   printf( "methuselah = %d\n", methuselah );
}