char getText() {
char text[100];
int c = 0;
do {
__fpurge(stdin);
printf("Enter text: ");
gets(text);
while (text[c] != '\0') {
if ((text[c] != '@')) {
if (text[c] == '@') {
printf("Contain @\n");
}
} else break;
c++;
}
} while (1);
return text;
}
I have this function check input string user enter. If string contain '@'. Require user enter again
If string not contain '@'. Accept string and return string.
But I can't break the loop. Anyone can help me solve problem. Thank first.