home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sams Teach Yourself C in 21 Days (6th Edition)
/
STYC216E.ISO
/
mac
/
Examples
/
Day05
/
var.c
< prev
Wrap
C/C++ Source or Header
|
2002-04-14
|
485b
|
29 lines
/* Demonstrates local variables. */
#include <stdio.h>
int x = 1, y = 2;
void demo(void);
int main( void )
{
printf("\nBefore calling demo(), x = %d and y = %d.", x, y);
demo();
printf("\nAfter calling demo(), x = %d and y = %d\n.", x, y);
return 0;
}
void demo(void)
{
/* Declare and initialize two local variables. */
int x = 88, y = 99;
/* Display their values. */
printf("\nWithin demo(), x = %d and y = %d.", x, y);
}