/* * ================================================================== * File2 : Demonstrate scope of variables and functions in a two file * C program. This file contains test function2 and "static" * test function 1. * * Copyright (C) 1998 by Mark Austin and David Chancogne. * * This software is provided "as is" without express or implied warranty. * Permission is granted to use this software on any computer system, * and to redistribute it freely, subject to the following restrictions: * * 1. The authors are not responsible for the consequences of use of * this software, even if they arise from defects in the software. * 2. The origin of this software must not be misrepresented, either * by explicit claim or by omission. * 3. Altered versions must be plainly marked as such, and must not * be misrepresented as being the original software. * 4. This notice is to remain intact. * * Written by : Mark Austin * ================================================================== */ #include float fTemperature; static int iValue1 = 5; static void testFunction1() { printf("In testFunction1() located in file 2 : Value1 = %d\n", iValue1); fTemperature += 32.0; } void testFunction2() { static enum { First, NotFirst } eCall = First; static int iNoCalls = 1; if( First == eCall ) { printf("In testFunction2() : First Call !!\n" ); testFunction1(); eCall = NotFirst; } else { iNoCalls += 1; printf("In testFunction2() : No Calls = %d\n", iNoCalls ); } }