Contents
Page-10
Prev
Next
Page+10
Index
Special Subroutines
In C, printf is an ordinary subroutine.
However, in Pascal write cannot be just an ordinary subroutine
because write must know the types of its arguments in order
to convert them correctly. This can be done in two ways:
- The compiler can add a type argument to the call to the
library routine:
write(x) → write(x, REAL)
- The compiler can call different library routines depending on the
argument type:
write(x) → writef(x)
We will assume the second convention for our assignments; we will use
write and writeln for strings, writei and writelni
for integers, and writef and writelnf for floats.