From the course: C: Data Structures, Pointers, and File Systems

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Create a pointer array

Challenge: Create a pointer array - C Tutorial

From the course: C: Data Structures, Pointers, and File Systems

Start my 1-month free trial

Challenge: Create a pointer array

(techno music) - [Instructor] Here's your chance to exercise some pointer muscles with a challenge. Create an array of 10 character pointers. Prompt the user for input, for example, to type the name of a fruit. Assign each string input to an address stored in the pointer array. After the 10 strings are collected and their address is stored in the array, output each one. Now, here are some tips to help you. All this activity can be done in the main function. You don't need to create any other functions to complete the challenge. I recommend collecting input in a buffer, and then copying the text input to memory allocated for the string. You do not need to use the dreaded double pointer notation anywhere in your code. This challenge should take 20 minutes or so to complete.

Contents