modification: strcpy and malloc for char*