© Giulio Zambon 2016

Giulio Zambon, Practical C, 10.1007/978-1-4842-1769-6_7

7. Dynamic Arrays

Giulio Zambon

(1)Harrison, Aust Capital Terr, Australia

The size of arrays in C is set at compile time. In the previous chapter, you learned a way of defining dynamically allocated C strings, which are arrays of characters. In this chapter, you will see how you can define at runtime arrays of any type. If you haven’t read Chapter 6, I suggest that you quickly go through it, so that you can use it as a reference for this chapter.

That said, it doesn’t mean that you can immediately convert the string functions and macros of Chapter 6 to work with any type of element because the conversion would present two immediate obstacles:

  • C strings are null-terminated, ...

Get Practical C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.