Fixed most of the problems with the StringUtils

+- Phase6_Prep.c
+- StringUtils.c

Note: Lev did things wrong using malloc in the videos. Corrections have been made.

Wrong: malloc( sizeof( sourceStrLen + 1 ) )
Correct: malloc( sizeof(char) * (sourceStrLen + 1) )

This will correctly fix most of the dynamic memory allocation problems that will arise from programs described in the video.
This commit is contained in:
Charles Descamps 2024-01-07 22:04:12 -07:00
parent cb03243373
commit 08677204ca
2 changed files with 7 additions and 5 deletions

View file

@ -66,10 +66,12 @@ int main()
printf("\nLowercase String: '%s'\n", testStringFour);
// string get to delimiter
// stringDelimiter
printf("\nAbout to get string to delimiter -> '.' from standard in:\n");
getStringToDelimiter(stdin, '.', testStringFive);
printf("\nCaptured to delimiter: '%s'\n", testStringFive);
// string get to end of line
// stringEOL
printf("\nAbout to get string to line end from standard in:\n");
getStringToLineEnd(stdin, testStringFive);
printf("\nCaptured to end of line: '%s'\n", testStringFive);