Sorry, I couldn’t find a link to make a suggestion for this lesson, but the Insert() code would look better like this:
void insert(int val) {
if(num_elements >= capacity) {
resize();
}
arr[num_elements]=val;
num_elements++;
}
Type your question above this line.
Course: https://www.educative.io/collection/5642554087309312/5646276079124480
Lesson: https://www.educative.io/collection/page/5642554087309312/5646276079124480/5745493850193920