最終更新:2021-01-19 (火) 01:37:10 (39d)  

C++/new
Top / C++ / new

プロトタイプ

  • void* operator new(std::size_t size);                                   // replaceable
    void* operator new(std::size_t size, const std::nothrow_t&) noexcept;   // replaceable
    void* operator new[](std::size_t size);                                 // replaceable
    void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
    void* operator new  (std::size_t size, void* ptr) noexcept;
    void* operator new[](std::size_t size, void* ptr) noexcept;

メモ

  • char* str1;
    char* str2;
    str1 = (char*)malloc(80);
    str2 = new char[80];
    free(str1);
    delete [] str2;//配列の開放