I have defined a set of states to categorize the text I want to analyse as follows:
#define PRE_WORT 0
#define IN_WORT 1
#define NO_WORT 2
#define WS_L 3
#define WS_T 4
#define BU 5
#define ZIFF 6
#define SONST 7
I then try to find out how many words, how many lines, longest word and longest line there are in the text, which is entered by the user and scanned via getchar()
.
To count the characters in a line, I set the value of characters in line counter to 0 by
if (character=='\n') {
line++;
if (count_char_line>=char_line_max) {
char_line_max=count_char_line;
count_char_line=0;
}
else {count_char_line=0;}
Am I doing that right? Or am I just setting the state of count_char_line
as PRE_WORT
?