Came from CSAPP “Figure 2.4”
|
|
- After
typedef unsigned char *byte_pointer;
, the typebyte_pointer
has the same functionality ofunsigned char *
%
starts the format,.2
means minimum 2 digits, pad with zeros if needed.start[i]
=*(start + i)
= $*(start + i \cdot sizeof(byte_pointer)$.- The expression
&x
creates a pointer to the location holding the object indicated by variable x. - The cast
(byte_pointer) &x
indicates that whatever type the pointer&x
had before, the program will now reference a pointer to data of typeunsigned char
. The casts do not change the actual pointer; they simply direct the comiler to refer to tha data being pointed to according to the new data type.