In article <3e**********************************@u12g2000prd. googlegroups.com>,
<aa*****@gmail.comwrote:
>Is it possible to write a C program to print o/p without using library
functions( in standard C )..????
On -some- implementations.
There are some implementations that have memory-mapped I/O --
writing a byte to a particular address causes the byte to be sent
to I/O (e.g., to a serial port or to a printer or whatever.)
Standard C does not -promise- that there is any way to write
data to a particular absolute address, but Standard C says that
it is implementation defined as to what the meaning is of converting
an integral value into a pointer. Hence an implementation is
allowed to define the conversion of magic absolute I/O addresses
into valid pointers to write to and thus to potentially trigger I/O.
Any program that used this technique would not be portable
to any other system that did not use memory-mapped I/O, or which
used different addresses for memory-mapped I/O, or to any system
that had memory-protection that prevented users from writing to
the magic addresses -- and of course it would not be portable to
any system that basically defines the result of converting an
integral value to a pointer as creating a useless junk pointer.
But any program that used this technique successfully for
a specific system would not be violating any constraint in C.
The ability to create arbitrary pointers is fairly common in C
implementations -- the C standard doesn't promise it will work
though.
--
"There is no greater calling than to serve your fellow men.
There is no greater contribution than to help the weak.
There is no greater satisfaction than to have done it well."
-- Walter Reuther