c++ changing array size - is it black magic or an illusion? š¤
Traditional rules state array size cannot change. however, with this array function it appears the array is changing in size. So question for the experts: is it actually changing size? Or is it an illusion (the array actually has 22 idx and only reports how many are being used)? I honestly don't have a clue! The array size is initially set at 7. Yet it is eventually increased to 22 and back to 5. However, in the other example (c++ array size), the array is set to have 5 idx. Even as they are empty, the size is always reported as 5. But in the case of the function, the array size *is* actually being reported as changing... And while size_arr is being passed to the function, the cout of the function never actually references that variable, it should only report the actual size: cout << sizeof(arr)/sizeof(int) << endl; as it does in the accompanying example. So, is it black magic or an illusion? https://code.sololearn.com/cB7UChgXGIGJ/?ref=app https://code.sololearn.com/cCBZXjZzTx17/?ref=app