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