can read user input into strings
This commit is contained in:
parent
aba255affa
commit
86cae67ee8
2 changed files with 10 additions and 4 deletions
14
puzzle1.c
14
puzzle1.c
|
|
@ -11,10 +11,16 @@ char stringTwo[stringSize];
|
|||
int readIntoList(char* stringList){
|
||||
int index = 0;
|
||||
|
||||
while (getchar()=='\n'){
|
||||
//eat up new lines in buffer
|
||||
}
|
||||
|
||||
while(1){
|
||||
char next = getchar();
|
||||
if (next != '\n'){
|
||||
stringList[index] = next;
|
||||
index++;
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
readChar = getchar();
|
||||
stringList[index] = readChar;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue