New course! Every coder should learn Generative AI!
Try a free lesson+ 2
You did not initialize <size>, but <size> is needed to verify whether <pos> was within a valid range value.
I think you better make a function for deleting (shifting) elements of the array cause you're doing it multiple times.