I'm trying to write a program that reads (accepts) a sentence with spaces until the user ends it with a point. for some reason, my code stops when the user types two points instead of only one, I'll leave my code below:
char sent[100];
int i;
printf("Write a sentence and end it with a point :\n");
for (i=0; sent[i]!='.'; i++)
{
scanf("%s",&sent[i]);
}
for (i=0; sent[i]!='.'; i++)sent[i]before you fill it in.%sreads a whole word, not a single character.&sent[i]makes very little sense. If the user typesabc defg.it's going to writeabcintochar[0]throughchar[2], then it will writedefgintochar[1]throughchar[4], overwriting part ofabc.