Computer programming - Lab 8

1. Implement your own version of the strtol function (initially for base 10, then for any base up to 36).

2. Write a function that takes as parameter a string, and creates a NULL-terminated array of addresses to the beginning of each (whitespace-separated) word in the string (similar to the argv[] array of main).

3. Write a function that takes a NULL-terminated array of strings (char *), another string buf and a maximal length, and concatenates all strings from the array into buf, separated by one space, without exceeding the length limit. Avoid strcat and maintain a pointer to the end of the string being constructed.

4. Use qsort to sort the characters in a string (in-place, modifying the string).

5. Implement your own version of binary search that searches for an int in a sorted array, using pointers to the endpoints of the array rather than indices. Test your programs with random values and comparing to bsearch.

Marius Minea
Last modified: Tue Nov 12 13:45:00 EET 2013