I have googled a lot to know how scanf and printf works.
But did not find any suitable answer.
Please help me.
Let say when we write
scanf("%d", i); // int i
how computer comes to know that the value has been entered from keyboard?
and how printf prints the data or output to the screen?
Please help me
They use the system primitives
readandwrite. You can see more about them here http://comsci.liu.edu/~murali/unix/read.htm and here http://codewiki.wikidot.com/c:system-calls:write and respectively read from stdin(file desc = 0) and stdout(file desc=1).