// This is the CORRECTED version of bad_example.cpp. #include #include int * good_function() { int * x = (int *) malloc(sizeof(int) * 1); *x = 5; return x; } int main() { int * a = good_function(); printf("a = %d\n", *a); free(a); }