Cryptography Reference
In-Depth Information
CHAPTER 8
Input, Output,
Assignment, Conversion
The numerals were now being converted automatically from base 2 to base
10
...
881, 883, 887, 907
...
each one confirmed as a prime number.
—Carl Sagan,
Contact
W
E BEGIN THIS CHAPTER WITH
assignment, the simplest and also the most
important function. To be able to assign to a
CLINT
object
a_l
the value of another
CLINT
object
b_l
, we require a function that copies the digits of
b_l
to the reserved
storage space for
a_l
, an event that we shall call
elementwise assignment
.Itwill
not suffice merely to copy the address of the object
b_l
into the variable
a_l
, since
then both objects would refer to the same location in memory, namely that of
b_l
,andanychangein
a_l
would be reflected in a change in the object
b_l
, and
conversely. Furthermore, access to the area of memory addressed by
a_l
could
become lost.
We shall return to the problems of elementwise assignment in the second
part of this topic when we concern ourselves with the implementation of the
assignment operator “=” in C++ (see Section 14.3).
The assignment of the value of a
CLINT
object to another
CLINT
is effected with
the function
cpy_l()
.
copy a
CLINT
object as an assignment
Function:
void cpy_l (CLINT dest_l, CLINT src_l);
Syntax:
src_l
(assigned value)
Input:
dest_l
(destination object)
Output: