/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that first allocates 16 characters,
copies the string "This is 16 chars" into them, and then
use realloc() to increase the size to 17 in order to place
a period at the end. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main() {
    char *p;
    
    p = malloc(16);
    if(!p) {
        printf("Allocation error - aborting.");
        exit(1);
    }
    strcpy(p,"This is 16 chars");
    p = realloc(p,17);
    if(!p) {
        printf("allocation error - aborting.");
        exit(1);
    }
    strcat(p,".");
    printf(p);
    printf("\n");
    free(p);
}
