1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-28 17:11:02 +02:00

Edit getchar() notes.

This commit is contained in:
Levi Bostian
2013-09-20 22:37:40 -05:00
parent 67cd987efa
commit 981cc871a4

View File

@@ -453,15 +453,14 @@ void str_reverse(char *str_in)
/////////////////////////////////////
// Built in functions:
/////////////////////////////////////
// from stdio.h:
// getchar()
int c = getchar(); //reads character from input.
// from: #include <stdio.h>
// ** getchar() **
// int c = getchar(); //reads character from input.
// If input = hi, 'h' is returned then next call, 'i' returned.
while ((c = getchar()) != EOF) { // EOF constant "end of file".
// Linux: CTRL+D, Windows: CTRL+X
// must have () around getchar() as != is run before =.
putchar(c); //prints character (without newline at end)
char c = getchar();
}
//if referring to external variables outside function, must use extern keyword.