Search code examples
c++arraysqtqt-designerqstring

How to compare two QString arrays Qt C++


i want to compare two QString Array with Qt and C++, i tried this, but it dosent work, (in fact my application crash...) :

if(ArrayOne[nb] != ArrayTwo[nb]){

}

And then i need to assign a value at an element of my array, but i dosent work too :

ArrayOne[nb] = ArrayTwo[nb];

To reach this :

if(ArrayOne[nb] != ArrayTwo[nb]){
ArrayOne[nb] = ArrayTwo[nb];
}

THANKS !


Solution

  • Your nb value is probably outside the range for the size of your QString. i.e., nb > ArrayOne.size-1.