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 - C Tutorial
From the course: C: Data Structures, Pointers, and File Systems
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.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Understanding pointers3m 19s
-
(Locked)
Using pointers to manipulate data2m 28s
-
(Locked)
Doing pointer math2m 57s
-
(Locked)
Comparing arrays and pointers3m 55s
-
(Locked)
Allocating storage3m 15s
-
Working with a pointer array3m 38s
-
(Locked)
Using pointers in structures3m 30s
-
(Locked)
Passing pointers to functions2m 57s
-
(Locked)
Returning pointers2m 39s
-
(Locked)
Challenge: Create a pointer array54s
-
(Locked)
Solution: Create a pointer array2m 23s
-
-
-
-