August 2011
Intermediate to advanced
552 pages
23h 48m
English
One shortcoming of C and Objective-C is code that performs a particular task becomes scattered around the code base. Say you are performing an operation on a C array of People structs and you need to sort the list by last name. Luckily, there is the library function qsort() to sort the array. qsort() is well-optimized and does its job well, but it needs some help. It does not know how items are compared to each other so that they end up in the proper sorted order.
... qsort (peopleArray, count, sizeof(Person), personNameCompare); ... int personNameCompare (const void *thing1, const void *thing2) { Person ...Read now
Unlock full access