Skip to Main Content
Practical C++
book

Practical C++

by Rob McGregor
August 1999
Beginner to intermediate content levelBeginner to intermediate
912 pages
15h 44m
English
Que
Content preview from Practical C++

Chapter 11. Allocating Memory in C++

<feature>
  • Understand the differences between allocating memory statically and dynamically

  • Learn about the stack and the free store

  • Discover the new and delete operators

  • See how you can dynamically allocate arrays

  • Learn to handle dynamic memory allocation errors

  • Find out how you can create your own new and delete operators

</feature>

Allocating Static Memory

When you declare a predesignated number of variables for a program to use during its execution, you are working with static memory. Static memory is reserved by the compiler at compile time. Let’s say you are planning to use an array of structures to represent employee data in a program, for example:

struct Employee { char FirstName[15]; char LastName[20]; float ...
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

Practical C++ Programming, 2nd Edition

Practical C++ Programming, 2nd Edition

Steve Oualline
C++ Cookbook

C++ Cookbook

D. Ryan Stephens, Christopher Diggins, Jonathan Turkanis, Jeff Cogswell

Publisher Resources

ISBN: 0789721449Purchase book