I have a question about storing information in array, I thought that when inside a loop, an array of size 200, for example char nome[200]
it would be filled continuously until no more space is left to save the information, causing the system to return an error, but in some examples I have done, the array is reused in the loop and instead of being "completed" in the space it it still has, it seems that the space that was used has the information replaced, if this really happens, why is the array not completed?
int main()
{
int n,i;
char ch;
int length;
scanf("%d", &n);
char abc[200];
for( i = 0; i < n; i++)
{
while( (ch = getchar() != '\n') && ch != EOF);
fgets( abc,200,stdin);
length = strlen( abc);
printf("%d", length);
printf("%s", abc);
}
}
This is an example. if I type a sentence of size 100 and then another one of size 100 the second will happen to take the place of the first, instead of completing the other 100 that remained? and if I type one of size 200 and then another of size 100, will replacement occur?