summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--c.html.markdown10
1 files changed, 10 insertions, 0 deletions
diff --git a/c.html.markdown b/c.html.markdown
index 4e1e1e56..7010b9d5 100644
--- a/c.html.markdown
+++ b/c.html.markdown
@@ -427,6 +427,16 @@ void str_reverse(char *str_in)
}
}
+// Built in functions:
+// from stdio.h:
+int c = getchar(); //reads character from user. If user types hello, only h is read.
+// getchar() can be stored into int or char. I am using int because char is not large
+// enough to store EOF used below.
+while (c != EOF) { // EOF is value for "end of file". Linux: CTRL+D, Windows: CTRL+X
+ putchar(c); //prints character (without newline at end)
+ char c = getchar();
+}
+
/*
char c[] = "This is a test.";
str_reverse(c);