#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/*
 * Program to allocate just enough space to hold a word.
 * Terry Harvey CISC 105 section 98 TA James Jamerson
 */

int main(){
    char * cp;
    char word[30];
    printf("enter a word: ");
    scanf("%s", word);

    cp = (char*)malloc( (strlen(word)+1) * sizeof(char)  );//number of bytes in the input word)

    strcpy(cp, word);
    printf("%s\n", cp);
    
    free(cp);

    return 0;
}
