This preview shows page 1. Sign up to view the full content.
Unformatted text preview: nsigned char.” Such a byte pointer references a sequence of bytes where each byte is considered to be a nonnegative integer. The ﬁrst routine show_bytes is given the address of a sequence of bytes, indicated by a byte pointer, and a byte count. It prints the individual bytes in hexadecimal. The C formatting directive “%.2x” indicates that an integer should be printed in hexadecimal with at least two digits.
New to C? The typedef declaration in C provides a way of giving a name to a data type. This can be a great help in improving code readability, since deeply nested type declarations can be difﬁcult to decipher. The syntax for typedef is exactly like that of declaring a variable, except that it uses a type name rather than a variable name. Thus, the declaration of byte_pointer in Figure 2.3 has the same form as would the declaration of a variable to type “unsigned char.” For example, the declaration: typedef int *int_pointer; int_pointer ip;
deﬁnes type “int_pointer” to be a pointer to an in...
View Full Document
- Spring '10
- The American