|
|
percentage
variable exists only in the calculatePercentage function. As soon as the function exits, that variable goes out of scope (dies)... meaning the pointer you are returning instantly becomes a bad pointer.percent
variable in main a normal float instead of a pointer.
|
|