Nominate our 2022 Qt Champions!

Clear an Array? how to clear array

  • i have an array that should be cleared if any number inside is not greater than 300.

    I have a device that sends data continuously to the QT GUI. And the array records them continuously into it.
    And i start my project if any of number greater than 300 comes.

    So array size becomes larger than array limit as time goes by and stopped working appears so i should do force stop.

    so need to clear the array if any number inside the array is not greater than 300.

    (i can not record data into array after number greater than 300 appears by some not offer me that.)


    Just i need to know how to clear or resize or reinitialize or any other thing that make it empty or .......

    any example please?

  • Moderators


    What is your array type? If you use QVector, call QVector::clear() (read the whole page to learn how to use QVector)

  • Dynamic array is from STL or Qt?

Log in to reply