So remember to use this everytime you malloc, say a string:
newstring = malloc ((strlen(oldstring)+1) * sizeof(char));
Remember to add 1 as well, just as I did: C strings terminate with a '\0', which is an extra character.
A little bit of the day-to-day and behind-the-scenes of my work as a PhD student in Computer Science at Columbia University.
newstring = malloc ((strlen(oldstring)+1) * sizeof(char));
No comments:
Post a Comment