we are using printf and scanf from #include<stdio.h> libraray functions.is it possible to write our own display statement and input statement

Member Avatar


yes u can. You can use putchar() and getchar and you can write fucntions using that.

Do you mean you want to write your own library for I/O or use macros for those existing functions? also fyi the latter is bad programming

is it possible to write our own display statement and input statement

Certainly. How do you think the stuff from stdio.h was written? One cool thing about the standard C library is pretty much all of it can be written directly in C. I've actually implemented the standard C library before, and whole books have been written with that focus.

As far as writing your own output function without utilizing the standard library, you'll almost certainly end up using a system library like Linux's write() or Windows' WriteFile(). Sure, you could use assembly interrupts, but that's just crazy talk unless you're writing for a platform that for some reason doesn't expose a C interface for I/O.

On a side note, the linked book is one of my favorites. The code is a hard read, but you can learn a lot from it.

everyone is reading from dennis ritchie implementations of library function.similiar to this in java package concept they are writting import java.awt.event where action listner they r writting i dont know how a byte code is translated into program such a great thing that is