counting characters program in c
- by mena
Hello,
the output of characters number is the actual no. plus 3
i don't know why?
This is the code:
void main(void)
{
int ch,w=0,c=0;
do
{
ch=getche();
++c;
if(ch==32)
{
++w;
++c;
}
}while(ch!=13);
printf("\nnum of characters is %d",c);
printf("\nnum of words is %d",w);
getch();
}