#include <stdlib.h> #include <stdio.h> struct db_entry { char* name; char* value; }; int main(int argc, char** argv) { // this is really an array! struct db_entry* bands; // get the number of bands int bandscount = 0; printf("How many bands? "); scanf("%d", &bandscount); // allocate enough bytes bands = malloc(bandscount * sizeof(struct db_entry)); int i = 0; for(i=0; i<bandscount; i++) { bands[i].name = "BAND"; bands[i].value = "WOO!"; // print the contents and the location (pointer) printf("Band %d address: %p\n", i, bands+i); printf(" %s => %s\n", bands[i].name, bands[i].value); } // release the memory free(bands); return 0; }