//* Use of variables - static modified local scope *

#include <stdio.h> int sum_so_far(int x) { static int sum = 0; // this variable is actually global but visible only inside this function // it is initialized only once, that is no later when you enter this function // for the first time but more likely it is initialized when the program starts sum = sum+x; return(sum); } int main() { for (;;) { int data, processed; scanf("%d", &data); if (data<0) break; processed=sum_so_far(data); printf("TL: %5d\n", processed); } return(0); }