#include <string.h> |
#include <stdio.h> |
#include <alloc.h> |
int main ( void ) |
{ |
char *str; |
/* allocate memory for string */ |
str = malloc ( 10 ); |
/* copy "Hello" to string */ |
strcpy ( str, "Hello" ); |
/* display string */ |
printf ( "String is %s\n" , str ); |
/* free memory */ |
free ( str ); |
return 0; |
} |