[Courses] Lesson 8: Something wrong in my source code

Bidea Cristian phaser_programmer at yahoo.com
Sat Nov 9 15:01:15 EST 2002


Ok the declaration char string[255] is not needed. Sorry but I forgot it there. I was to implement other solution and I forgot it.

There was something like this

#include <stdio.h>

char string[255];

char c;

int counter = 0;

int main(void)

{

printf("Enter the string please: ");

do {

       scanf("%s", &string);

       scanf("%c", &c);

       counter++;

     } while ((c != '\0') && (c != '\n'));

   printf("There are %d words", counter);

return 0;

}

This is a much simpler solution, but I wrote it on the fly, so don't expect everything to work fine... I wanted to ilustrate only an idea.

OK that's all! Bye! Peace...



---------------------------------
Do you Yahoo!?
U2 on LAUNCH - Exclusive medley & videos from Greatest Hits CD-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linuxchix.org/pipermail/courses/attachments/20021109/98a76de9/attachment.xhtml


More information about the Courses mailing list