Getche

/*This program will demonstrate how to create a string from
the keyboard one character at a time.*/

#include<stdio.h> // printf 
#include<conio.h> // _getche
main()
{
	char st[21];
	char ch;
	int c=0;
	printf("Enter a String: ");
	do
	{
		fflush(stdin);//flushing the input stream
		ch = _getche();//getting first character	
		st[c]=ch;
		c++;//counting number of character entered
	}
	while (ch!=13);//accepting all but a return
	
	st[c]='\0';//putting null at end of string
	printf("You entered the string : %1s\n",st);
	return 0;
}


/*
Enter a String: a84nd
You entered the string : a84nd
*/