void* realloc(void* vpOldMemory, size_t qSizeInBytes);
#include <iostream> #include <cstdlib> int main() { using namespace std; char* cpOldMemory = (char*)malloc(10); char* cpMemory = (char*)realloc(cpOldMemory, 20); if (cpMemory == 0) { free(cpOldMemory); cout << "realloc failed" << endl; } else { cout << "realloc successful" << endl; } free(cpMemory); return 0; }
© 20072024 XoaX.net LLC. All rights reserved.