This will be the first of a series of Programming exercises I'm counting on proposing on the forum. The idea is simple: I propose a subject, anyone who wants to participate can post his code. It is not a competition. The idea is to get code review from other developers. So here goes:
WordCount
You are asked to create a program that counts the number of words in a text file.
Definition of a word: The longest continuous sequence of alphanumerical characters. Words can be separated by space character (" "), \t, \r or \n.
For the sake of simplicity, we won't go into the validation of the input, considering that it will always be a valid text file (as opposed to a bitmap for example).
Oh and one last thing, program should be coded in C.
I'm gonna start working on it, and post my code as soon as I'm done. Do not hesitate to post your code, questions or whatever.
Next exercise will be Java :)
Have fun.
N.B: It is not a competition, don't try to post your code super fast. Take your time to develop a pretty (I want to say artistic) solution.
WordCount
You are asked to create a program that counts the number of words in a text file.
Definition of a word: The longest continuous sequence of alphanumerical characters. Words can be separated by space character (" "), \t, \r or \n.
For the sake of simplicity, we won't go into the validation of the input, considering that it will always be a valid text file (as opposed to a bitmap for example).
Oh and one last thing, program should be coded in C.
I'm gonna start working on it, and post my code as soon as I'm done. Do not hesitate to post your code, questions or whatever.
Next exercise will be Java :)
Have fun.
N.B: It is not a competition, don't try to post your code super fast. Take your time to develop a pretty (I want to say artistic) solution.