Causes of Memory Leaks in C Language
1 Uninitialized Pointer in Struct Member struct student{ char *name; // Only 4 bytes allocated, not pointing to a valid address, contains garbage values int score;}stu, *pstu; int main(){ strcpy(stu.name, "code"); // This will cause an error, the solution is to malloc space for the name pointer stu.score = 99; return 0;} Another error: int … Read more