From the course: Complete Guide to C Programming Foundations

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Challenge: Allocating structures

Challenge: Allocating structures - C Tutorial

From the course: Complete Guide to C Programming Foundations

Challenge: Allocating structures

(upbeat music) - [Instructor] Your challenge is to create an array of structure pointers. Each structure contains two members: an integer and a character. The array contains 26 elements, each a pointer to a structure. Allocate storage for each of the 26 structures in the array. After successfully allocating memory, assign the structure's members. For the integer member, assign values 0 through 25. For the character member, assign letters A through Z. As examples, the first allocated structure has integer value 0 and character value A. The last structure has integer value 25 and character value Z. Once allocated and assigned, output the data stored in each structure. After output, ensure that you release memory assigned to each structure. I have provided a source code skeleton you can use to get started. It's available in the exercise files. This challenge should take around 15 minutes to complete.

Contents