How to insert a single value into every array alement?
I am currently using this code...
for (int i = 0; i < m_size; i++)
m_array[i] = EMPTY_CELL;
EMPTY_CELL is -666.
m_array is a dynamic array pointing to an integer.
Instead of using an O(n) algorithm I'm just wondering if there's a faster way using mem* or other functions? The reason why I'm interested is because EMPTY_CELL is a constant, so it seems like there may be a faster way than having to go through every single element in the array. But even if there was a C/C++ function for this, I can only guess it's O(n) too. But I thought I'd ask anyway so I can lay this idea to rest. Thanks!