summaryrefslogtreecommitdiff
path: root/hw3/problem1.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw3/problem1.c')
-rw-r--r--hw3/problem1.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/hw3/problem1.c b/hw3/problem1.c
new file mode 100644
index 0000000..784b570
--- /dev/null
+++ b/hw3/problem1.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+void getString(char *in, int buffer){
+ char *c = in;
+ for(; c < in + buffer; c++){
+ *c = getchar();
+ if(*c == EOF)
+ break;
+ }
+ *c = '\0';
+}
+
+int main(){
+ char test[256];
+ getString(test,100);
+ printf("Got string: %s\n", test);
+}