Counting total space,tab,new line in a string.
dam_fool_2003_at_yahoo.com
Date: 03/31/04
- Next message: Peter Dunker: "C-API for Xerces-c ?"
- Previous message: Richard Bos: "Re: A quick if question"
- Next in thread: Richard Bos: "Re: Counting total space,tab,new line in a string."
- Reply: Richard Bos: "Re: Counting total space,tab,new line in a string."
- Reply: Malcolm: "Re: Counting total space,tab,new line in a string."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Mar 2004 00:59:21 -0800
The program:
A small program to find a number of space in a string so that I can
count each spaced char as a word. Following that I can find total no
of words. The program should also able to find the "enter", "tab".
The following is not the correct solution. But can any body give any
help , like any key word to search in the google.
#include<ctype.h>
#include<stdio.h>
#include<string.h>
int main(void)
{
char *string = "dam fool 2003";
int i,j=0;
for(i=0 ; i<strlen(string) ; i++)
{
if(isspace(string[i]))
{
printf(" %d space in fool\n",j);
j++;
}
else
printf("no space\n");
}
return 0;
}
- Next message: Peter Dunker: "C-API for Xerces-c ?"
- Previous message: Richard Bos: "Re: A quick if question"
- Next in thread: Richard Bos: "Re: Counting total space,tab,new line in a string."
- Reply: Richard Bos: "Re: Counting total space,tab,new line in a string."
- Reply: Malcolm: "Re: Counting total space,tab,new line in a string."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|