QA.TechInterviews.com - your tech questions answered
How To Count Letters,Lines,Digits ,Blank Spaces And Others In The Program In C Programming?

void count (char *text,
int *letters,
int *lines,
int *spaces){
*letters = 0;
/* all files start on line 1 */
*lines = 1;
*spaces = 0;
/* keeps incrementing pointer until it finds \0*/
for(;*text; text++){
if (isalpha(*text)) *letters++;
else if(*text == '\n') *lines++;
else if(*text == ' ' || *text == '\t')
*spaces++;
}
}
Copy the whole this into Word and press F7.
Ignore all spelling & grammatical errors.
A summary should appear.

If not configure it in the Tools Menu >> Options
Then repeat the steps.

It's pretty self-explanatory... You'e a programmer after all.
void count (char *text,
int *letters,
int *lines,
int *spaces){
*letters = 0;
/* all files start on line 1 */
*lines = 1;
*spaces = 0;
/* keeps incrementing pointer until it finds \0*/
for(;*text; text++){
if (isalpha(*text)) *letters++;
else if(*text == '\n') *lines++;
else if(*text == ' ' || *text == '\t')
*spaces++;
}
}

Back to QA. TechInterviews.com. Powered by Yahoo! Answers and TechInterviews.com community.