1 #include <stdio.h> 2 #include <signal.h> 3 4 5 #ifdef PROTOTYPES 6 void handle_USR1(int sig)7handle_USR1 (int sig) 8 { 9 } 10 #else 11 void handle_USR1(sig)12handle_USR1 (sig) 13 int sig; 14 { 15 } 16 #endif 17 18 int value; 19 20 #ifdef PROTOTYPES 21 int main(void)22main (void) 23 #else 24 int 25 main () 26 #endif 27 { 28 int my_array[3] = { 1, 2, 3 }; /* break main */ 29 30 value = 7; 31 32 #ifdef SIGUSR1 33 signal (SIGUSR1, handle_USR1); 34 #endif 35 36 printf ("value is %d\n", value); 37 printf ("my_array[2] is %d\n", my_array[2]); 38 39 { 40 int i; 41 for (i = 0; i < 5; i++) 42 value++; /* increment value */ 43 } 44 45 return 0; /* after loop */ 46 } 47 48