Skip to Main Content
C Programming: Visual Quickstart Guide
book

C Programming: Visual Quickstart Guide

by Larry Ullman, Marc Liyanage
October 2004
Beginner content levelBeginner
408 pages
9h 24m
English
Peachpit Press
Content preview from C Programming: Visual Quickstart Guide

Allocating Arrays of Dynamic Size

In the previous section you allocated a block of memory and used it. However, it was a very small block of memory—only the size needed to store an integer. You could have allocated the same amount of memory statically by simply defining a regular integer variable in the program. And, although the amount of memory was determined at runtime, it was still of a fixed size (the size required to store an integer).

Memory management gets a lot more interesting if you determine the amount of memory to request from the pool at runtime, and if the requested amount is larger. In this section you will allocate room for an array of integers. To make it clear that the size of the array is dynamic, this program will ask the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Intermediate C Programming

Intermediate C Programming

Yung-Hsiang Lu
Data Structures Using C

Data Structures Using C

Samir Kumar Bandyopadhyay, Kashi Nath Dey

Publisher Resources

ISBN: 0321287630Purchase book