In a book I am learning from the author does this:
1 2
unsignedchar* storage;
storage=0;
however whenever I try this I get a Bad<Ptr>
CXX0030: Error: expression cannot be evaluated
for storage when I run debug. Am I overlooking something or should this be an error?
//Stash.h
struct Stash {
int size; // Size of each space
int quantity; // Number of storage spaces
int next; // Next empty space
// Dynamically allocated array of bytes:
unsignedchar* storage;
// Functions!
void initialize(int size);
void cleanup();
int add(constvoid* element);
void* fetch(int index);
int count();
void inflate(int increase);
};
// Stash.cpp
void Stash::initialize(int sz) {
size = sz;
quantity = 0;
storage = 0; // here is where I get the Bad <Ptr>
next = 0;
}