usha
01-21-2006, 06:22 AM
hi
here i am writing u a code to read from key board(stdin) and write on the screen(stdout).
main()
{
char ch;
printf("enter a character ");
read(0,&ch,1);
write(1,&ch,1);
}
now there is no problem in execution. but i have doubt in execution. when i dont give any \n
in the printf statement at the end then first read is getting executed and then printf.if i give \n then printf is executed first then read.
why does this happen
pls give clarification
thanks in advance
usha
here i am writing u a code to read from key board(stdin) and write on the screen(stdout).
main()
{
char ch;
printf("enter a character ");
read(0,&ch,1);
write(1,&ch,1);
}
now there is no problem in execution. but i have doubt in execution. when i dont give any \n
in the printf statement at the end then first read is getting executed and then printf.if i give \n then printf is executed first then read.
why does this happen
pls give clarification
thanks in advance
usha