WIP overbuilt solution to exercise 1-17.
This commit is contained in:
parent
2084b2ae84
commit
848898ff11
2 changed files with 101 additions and 0 deletions
25
KNR C/ex1-17/store.c
Normal file
25
KNR C/ex1-17/store.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include <stdio.h>
|
||||
|
||||
char buffer[32000] = {0};
|
||||
|
||||
void store(char to[]){
|
||||
int toCrsr = 0;
|
||||
for(int i = getchar();i != EOF; ++toCrsr){
|
||||
to[toCrsr] = i;
|
||||
i = getchar();
|
||||
}
|
||||
}
|
||||
|
||||
void test(){
|
||||
int pos = 0;
|
||||
|
||||
for(char b = buffer[pos]; b != 0; ++pos){
|
||||
putchar(buffer[pos]);
|
||||
b = buffer[pos];
|
||||
}
|
||||
}
|
||||
|
||||
int main(){
|
||||
store(buffer);
|
||||
test();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue