We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1d7ba6 commit 58db924Copy full SHA for 58db924
prog.10.6.c
@@ -0,0 +1,34 @@
1
+#include <stdio.h>
2
+
3
+int main (void)
4
+{
5
+ int i;
6
+ char line[81];
7
+ void readLine (char buffer[]);
8
9
+ for ( i = 0; i < 3; ++i )
10
+ {
11
+ readLine (line);
12
+ printf ("%s\n\n", line);
13
+ }
14
15
+ return 0;
16
+}
17
18
+// Function to read a line of text from the terminal
19
20
+void readLine (char buffer[])
21
22
+ char character;
23
+ int i = 0;
24
25
+ do
26
27
+ character = getchar ();
28
+ buffer[i] = character;
29
+ ++i;
30
31
+ while ( character != '\n' );
32
33
+ buffer[i - 1] = '\0';
34
0 commit comments