[Solved] length of a character pointer not correct using strlen()


The argument a (a pointer) is passed to input() by value. So the change a = regrowchar(a, size) is not visible to main(). Pass it by reference. Also, although you haven’t asked, your code leaks memory, since it dynamically allocates but never deallocates.
by https://stackoverflow.com/users/4706785/peter

2

solved length of a character pointer not correct using strlen()