C examples for String:String Console Input
Reading Lines of String Data with your own function
#include <stdio.h> void readLine (char buffer[]); int main (void){ char line[81]; /*w w w . j a v a 2s. c o m*/ for (int i = 0; i < 3; ++i ){ readLine (line); printf ("%s\n\n", line); } return 0; } void readLine (char buffer[]){ char character; int i = 0; do { character = getchar (); buffer[i] = character; ++i; } while ( character != '\n' ); buffer[i - 1] = '\0'; }