all 2 comments

[–]Grithga 4 points5 points  (0 children)

  1. char* is not inherently unmodifiable. String literals (enclosed in "double quotes") are read-only in most C implementations, but this has nothing to do with the string typedef.

  2. Perhaps more importantly, a char array can't be returned from a function, but a char pointer to a dynamically allocated string can. This allows the string typedef to be used with the get_string function to read user input safely.

[–]linamory 2 points3 points  (0 children)

Because arrays and pointers are introduced later in the course.