There is an array, it can contain as many records as you like and very often 0 or 1. And you need to add another entry to those that exist. Now I add, but I have one entry added and the next entry simply overwrites the previous one and becomes its place. How can I add without knowing the key?

    1 answer 1

    look for something similar to the C ++ library "vector", where you create an object

    vector<typedef> name; /*и заталкиваешь значения с помощью*/ name.push_back(smth); /*обращение к элементам может быть либо через итераторы, либо через оператор []*/ 
    • one
      And what does CPP have to do with it and how does your answer differ from the previous one?) - Sh4dow