The previous lab introduced you to pointers in C, structs, and more general file I/O. C pointers play several roles - they serve as object references, they provide information hiding, they provide a level of indirection, and the enable passing arguments in a manner that allows them to be modified by subroutines. We will see more about pointers today, but this quiz will check your basic understanding of last lab's material.

Write a function imax that takes as input an integer array and integer length of the array and returns an integer that is the index of the largest element in the array.

C has a very useful string library that is obtained with

#include <string.h>
. One of the functions in it is strlen. Write a function strlen that takes as input a string (char *) and returns an int that is the length of the string.

Write a function skip that takes as input a string (char *) and returns a string that begins with the first non-whitespace character in the input string. It should do no copying of the string.

Write a declaration of a struct person that contains three elements, a string name, an int age, and a char gender.

Write a function printPerson that takes as input a FILE* and a struct person, as in the previous question, and prints the person in a three column format.