user input fix

This commit is contained in:
Seth Samuel 2024-12-01 19:55:24 +13:00
parent 86cae67ee8
commit b37a846ed2
2 changed files with 12 additions and 16 deletions

BIN
puzzle1

Binary file not shown.

View file

@ -11,26 +11,22 @@ char stringTwo[stringSize];
int readIntoList(char* stringList){
int index = 0;
while(1){
char next = getchar();
if (next != '\n'){
stringList[index] = next;
index++;
}else{
break;
}
}
while (1) {
readChar = getchar();
stringList[index] = readChar;
if (readChar == '\n' || index == stringSize-1) {
break;
while (1)
{
char next = getchar ();
if (next == '.')
{
break;
}
else if (next != '\n')
{
stringList[index] = next;
index++;
}
index++;
}
}
int main(){
printf("enter list size: \n");