// Pantea Aria // Memory Leak Example (Lost Pointer) // Complete the TODO sections below // (Memory is allocated twice but only one freed) // use "dcc --leak-check program_name.c -o program" to see the error message #include #include int main(void) { // TODO 1: // Allocate memory for one integer int *ptr = ? // TODO 2: // Store the value 10 in the allocated memory // TODO 3: // Allocate NEW memory to ptr again // TODO 4: // Explain in a comment: // What happened to the first allocated memory? // TODO 5: // Free the memory currently pointed to by ptr return 0; }