Hie everyone.. I am a newbie and learning c programming.. I refered the site and found ansic is the best book) thanks to cprogramming.com.. I am reading it..
Therein the author asked us to write a program to print input to output by removing extra balnks..
I have writen the following code.. No errors! But it does not print anything except for the printf statement... why so?
Code:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int v,bcount=0;
printf("Type in the string that you want to edit...\n \n Now!\n");
while( (v=getchar()) != EOF);
{
if(v!=' ')
{
putchar(v);
bcount=1;
}
else if(v==' ')
{
while(bcount==1)
{
putchar(v);
++bcount;
}
}
}
return(7);
}
Plz help !