I have copied the code from the book thinking in c++ volume 1 and wanted to ask
whether the following piece of code is leaking memory since there is no delete for the new operetor in line 50 of the cpp file? This book is regarded a lot , so i thought that I might be wrong somewhere ...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//: C04:CLib.h
// Header file for a C-like library
// An array-like entity created at runtime
typedefstruct CStashTag {
int size; // Size of each space
int quantity; // Number of storage spaces
int next; // Next empty space
// Dynamically allocated array of bytes:
unsignedchar* storage;
} CStash;
void initialize(CStash* s, int size);
void cleanup(CStash* s);
int add(CStash* s, constvoid* element);
void* fetch(CStash* s, int index);
int count(CStash* s);
void inflate(CStash* s, int increase);
///:~