From the course: C Programming Basics: Flow Control, Variables, and Pointers
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
Working with pointer arrays - C Tutorial
From the course: C Programming Basics: Flow Control, Variables, and Pointers
Working with pointer arrays
- [Trainer] Just like any data type, you can create an array of pointers. It's an array of memory locations, but those pointers must reference some type of data. Why would anyone want to do such a crazy thing? Let me tell you here you see a pointer array. It contains room for 12 memory locations. Those locations are preset to the strings listed. This declaration is for an array of strings, although that's not technically correct. The strings are displayed by using a for-loop at line 21, build and run the code. Each string is displayed to help demonstrate that the array is a clutch of memory locations, modify the code in line 22 change the percent S to percent P. This change displays a memory location and not a string save, build and run and you see a series of memory locations because the compiler allocated space for each of the strings and stuck null characters at the end, each memory location does reference a…
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
-
-
-
-
-
-
-
Exploring variables4m 55s
-
(Locked)
Understanding pointers4m 54s
-
(Locked)
Using pointers4m 14s
-
(Locked)
Challenge: Create a char pointer1m
-
(Locked)
Solution: Create a char pointer1m 16s
-
(Locked)
Accessing arrays with pointers6m 46s
-
(Locked)
Creating pointer functions4m 52s
-
(Locked)
Working with pointer arrays4m
-
(Locked)
Allocating memory4m 50s
-
(Locked)
Challenge: Write a Hello program28s
-
(Locked)
Solution: Write a Hello program1m 33s
-
-