Exercises

  1. Write a C subroutine that computes the parity of an integer value.

  2. Create a function that computes the 16-bit CRC for a string.

  3. Many different C libraries are available. Pick one and write a set of Inline::C functions for it. (For example, try the zlib compression library; you can find it at http://www.zlib.org.)

  4. Write a high-speed version of unpack. This function takes a single scalar string as its argument, assumes that it’s an array of integers (int[]), and returns a Perl version of the integer array.

Get Perl for C Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.