c++ memcpy return value

前端 未结 5 1642
囚心锁ツ
囚心锁ツ 2021-02-05 02:20

according to http://en.cppreference.com/w/cpp/string/byte/memcpy c++\'s memcpy takes three parameters: destination, source and size/bytes. it also returns a pointer

5条回答
  •  庸人自扰
    2021-02-05 02:42

    void *memcpy(void* dest, const void* src, std::size_t count);
    //returns void * which can be assigned to another void array that can be used as int or char data type.
    void *ret = new int[6];
    ret = memcpy(newarr, arr, sizeof(int)* 5);
    

提交回复
热议问题