hi i wanted to write a program thats able to count the white spaces in a user input.


main ()
	int c, white;
	white = 0;
	while((c=getchar()) != EOF)
		if(c==' ')
			printf("%d white spaces in your text\n", white);
			white = 0;
this code is going to count the whitespaces not the way i want them counted!
i want only one line being displayed
after i hit return.
ie. 5 white spaces in your text
or 2 white spaces in your text

i tried to set the value of white to zero after every count, but doesnt work either. i guess its a simple mistake.

please help