Can somebody explain why I'm getting this error after program ends?
free(): invalid pointer
This is my code:
#include <iostream>
#include <memory>
int main()
{
int a = 3;
std::unique_ptr<int> up(&a);
std::cout << a << std::endl;
std::cout << *up << std::endl;
std::cout << &a << std::endl;
std::cout << up.get() << std::endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire