vendredi 27 mars 2015

Why this code may crash in C++ (pointer return)?


int& subtraction(int& a,int& b) {
int* pc = new int;
*pc = a - b;
return (*pc);
}


I run this code on windows it is correct,but when I do the same thing on Linux it cause some problem.It does not result in a run-time error,what is the problem. Thanks


Aucun commentaire:

Enregistrer un commentaire