arr[size++] = temp;

your increment here "fully" completes within the brackets and thus the first pass through skips arr[0]