>No, because enlarge() is called before arr[size] is used, i.e. we enlarge first then use.
The problem is arrays run from 0 to size-1, so if size is 4 you are already writing one past the array. For example:If size is 4 before this statement, and your array is 4 elements, you already need to enlarge the array, because there is no:Code:arr[size++] = temp;
There's only arr[0] thru arr[3].Code:arr[4]