Category : Files from Magazines
Archive   : CGAZV5N3.ZIP
Filename : ARRAY.CPP

 
Output of file : ARRAY.CPP contained in archive : CGAZV5N3.ZIP
//******** Listing 7 ********************** ARRAY.CPP ****
// ARRAY.CPP : implementation of class dynamic_array
// (c) C Gazette. See Listing 1 for usage.
//********************************************************

#include "array.hpp"
#include

void dynamic_array::error(char * msg) {
fprintf(stderr, "dynamic_array error: %s\n", msg);
exit(1);
}
dynamic_array::dynamic_array(size_t sz) {
size = sz;
// can still use malloc and calloc if you want!
vec = (int*)calloc(sz, sizeof(int)); // cast required by C++
if(vec == NULL) error("out of memory in create_array");
}

dynamic_array::~dynamic_array() {
free(vec); // free memory used for vec
}


  3 Responses to “Category : Files from Magazines
Archive   : CGAZV5N3.ZIP
Filename : ARRAY.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/