1. Print from address array
Write a function int myprintf(const char *fmt, void *adrtab[])
that works like printf, but receives a NULL-terminated array of
addresses (void *) of objects to be printed.
Implement the format specifiers %d, %f and %s, as well as printing regular
characters and %.
An error encountered in the format should terminate printing.
2. Read to address array Write a function int myscanf(const char *fmt, void *adrtab[]) that works like scanf, but receives a NULL-terminated array of addresses (void *) of objects to be read.
3. Print from buffer
Write a function int bufprintf(const char *fmt, void *buf, size_t size)
that works like printf, but receives a buffer from which
it takes the values to be printed, and the size of that buffer.
Values are stored at consecutive bytes in the array.
Implement the format specifiers %d, %f and %s, as well as printing regular
characters and %.
An error encountered in the format or reaching the end of the buffer
should terminate printing.
4. Read into buffer Write a function int bufscanf(const char *fmt, void *buf, size_t size) that works like scanf, but receives a buffer into which it should place values and its size. Values read should be stored at consecutive bytes in the array.
5. Countif
Write a function that counts how many elements in an array satisfy a given
condition.
The function takes as parameters an array, its element count, element size, and a pointer to a function. That function takes as parameter a pointer to an element (as void *) and returns nonzero (meaning the element satisfies
the desired condition) or zero (it does not). Test your function in a program.
6. Map
Write a function that changes all elements of an array by calling a function.
The function takes as parameters an array, its element count, element size, and a pointer to a function. That function takes as parameter a pointer to an element (as void *) and changes the value of the element. Test your function in a program.
7. Partition
Write a function that rearranges the elements of an array: first all that satisfy a given property, and then all that don't.
The function takes as parameters an array, its element count, element size, and a pointer to a function. That function takes as parameter a pointer to an element (as void *) and returns nonzero (meaning the element satisfies
the desired condition) or zero (it does not). Test your function in a program.
For example, you could group elements of an array that are less than / not less than a given value (this partitioning step is used in quicksort).