i have to do an exercise where i need to acquire from keyboard a text, with 1000 max rows and every rows have a limit of 100 max characters.
Also i need to finish the acquisition of the input when the user type the row with the word "END" and i must show all the acquired rows without the "END" row, and also all the alphanumeric characters used, and at the end, the total number of used words.
I've tried to acquire the rows from keyboard through an array, but the for loop used for add rows, doesn't work well,indeed the loop ends after the first call.
I think this happens because the array is filled, but i don't know why and how to fix it.
This is my code:
#include <stdio.h>
#define MAX_ROWS 1000
#define MAX_CHARACTERS 100
int main() {
int i;
char text[MAX_CARACTERS];
for(i=0;i<MAX_ROWS && text!="END";i++) {
scanf("%98[^\n]",text);
}
return 0;
}