#include "structs.h" using namespace std; //main function: entry point of the program int main() { Book b1; b1.pages = 500; b1.title = "CS162"; b1.num_authors = 2; b1.authors = new string [b1.num_authors]; b1.authors[0] = "Roger"; b1.authors[1] = "Some author"; print_book(b1); delete [] b1.authors; b1.authors = nullptr; int size = 0; cout << "Enter the size of your book array: "; cin >> size; //create a dynamic array of books Book* book_arr = new Book [size]; book_init(book_arr, size); //alternatively, if using book_init_one_book(), do the following: // for (int i = 0; i < size; ++i) // { // book_init_one_book(book_arr, i); // } for (int i = 0; i < size; ++i) { //print book obj at idx i print_book(book_arr[i]); } delete_books(book_arr, size); // Q: what's the output of the following cout? // is it null (0x0)? cout << book_arr << endl; //book_arr = nullptr; return 0; }