Příklad

int main(int argc, char* argv[])
{

int *a = static_cast<int *>(malloc(sizeof(int )));
delete a;
   
int *b = new int;
free(b);

return 0;
}

Řešení
Použijte free() pro zrušení přidělení paměti přidělené pomocí malloc() a "delete" pro zrušení přidělení paměti přidělené pomocí "new".

int main(int argc, char* argv[])
{


int *a = static_cast<int*>(malloc(sizeof(int)));
free(a);
   
int *b = new int;
delete b;

return 0;
}