[Tutor] Static Variables

Ashkan Aliabadi a_aliabadi at cse.shirazu.ac.ir
Sat Aug 28 11:21:35 CEST 2004

Hi folks,
Man, I never knew static could mean so much! That's the difference between 
a pro and a newbie, By static variable I meant a variable that holds it's 
value between function calls as in C, like Mr.Yoo's example or this one:

/* I know this is not a good example but I guess it can show what I mean 
#include <stdio.h>

void print_star(void);

int main(void){
	for (counter = 0; counter <50; ++counter){
	return 0;

void print_star(void){
	static int i = 0;
	if (i<50){

By the way, would anyone guide me how to become a pro in C (an e-book, 
some maillists, some hints or just whatever you think may be helpful)? I 
read Kernighan and Ritchie's "THE C PROGRAMMING LANGUAGE", but I need something that 
makes me a real man!! enough for now ;) so many questions, so little 
time ( or as Duke Nukem says: so many babes so little time )

thank you for being kind
Ashkan A.

More information about the Tutor mailing list