A
alex323
Hey everybody. I am coding a function that takes a string as an
argument (char *msg) and breaks it up into pieces. The result will be
stored in (char ***fragments) which is passed as an argument. The
caller calls myfunction(mymsg, &my_fragment_array) where
`my_fragment_array' is a char **. My problem is that the array is
perfectly constructed inside the function, but when I switch frames in
GDB to see the caller, the second element of the array is either null
or memory garbage. How can I dynamically allocate an array of strings
from inside a function for use outside a function?
argument (char *msg) and breaks it up into pieces. The result will be
stored in (char ***fragments) which is passed as an argument. The
caller calls myfunction(mymsg, &my_fragment_array) where
`my_fragment_array' is a char **. My problem is that the array is
perfectly constructed inside the function, but when I switch frames in
GDB to see the caller, the second element of the array is either null
or memory garbage. How can I dynamically allocate an array of strings
from inside a function for use outside a function?