C examples for Data Type:char
Using getch() to input strings and read Non-ANSI code, \r
#include <stdio.h> #include <conio.h> #define MAX 80/* ww w . j a va2 s. c o m*/ int main( void ) { char ch, buffer[MAX+1]; int x = 0; while ((ch = getch()) != '\r' && x < MAX) buffer[x++] = ch; buffer[x] = '\0'; printf("%s", buffer); return 0; }