Add string value to array

Inside a while loop, I have an array of CAPACITY = 32, and 16 string values/elements in the array. When I add a string value via

1
2
3
4
5
if (current_size < CAPACITY)
{
    current_size++;
    values[current_size - 1] = new_element;
}


a linear search detects if the new string value already exists in the array; if it isn't in the array, it should add the new_element to the array and print it along with the other values when that option is selected (in order to select the print option, it goes through the while loop and back to the beginning of the loop). Problem is, it doesn't print the new_element aka the new string value that I input. What am I doing wrong?
give us the rest of the code so that we can see the whole thing like what is current_size? I assume it is a variable of some type but it is none the less ambiguos also just a guess from what I see but it seems like this is a problem with the while loop not necesarily the statement body in the while loop. please give more code.
Topic archived. No new replies allowed.