I have done slight modifications. now it is not storing function keys check it
Code:
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
int i=0;
char c='\0',s[50],d;
clrscr();
do
{
c=getch();
if(c>31 && c<127)
{
s[i]=c;
i++;
}
else if(c==13)
{
s[i]='\0';
printf("%s",s);
}
else //or else if(c==0) both r ineffective
{
d=getch();
sound(400);
delay(50);
nosound();
}
}while(c!=13);
getch();
}