/* * fgets-into-heap.c */ #include #include int main(int argc, char *argv[]) { char *heap_pointer; heap_pointer = malloc(25); printf("heap_pointer is stored at %p\n", &heap_pointer); printf("heap_pointer has value %p\n", heap_pointer); printf("Enter a string: "); fflush(stdout); fgets(heap_pointer, 25, stdin); printf("You entered \"%s\"\n", heap_pointer); }