Horje
double array size c++ Code Example
double array size c++
void enlarge(int *& array, int size) {
//                ^
// Use a reference to a pointer.

    int *dbl = new int[size*2];
    for (int i = 0; i < size; i++) {
    //                  ^
    // Iterate up to size, not size*2.
        dbl[i] = array[i];
    }
    delete[] array;
    //    ^
    // Use delete[], not delete.
    array = dbl;
}




Cpp

Related
c++ namespace Code Example c++ namespace Code Example
c++ check that const char* has suffix Code Example c++ check that const char* has suffix Code Example
read a whole line from the input Code Example read a whole line from the input Code Example
how to concatenate two vectors in c++ Code Example how to concatenate two vectors in c++ Code Example
union cpp Code Example union cpp Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10