A
A
alex4answ2019-01-12 23:13:04
C++ / C#
alex4answ, 2019-01-12 23:13:04

Type mismatch when comparing int and vector.size()?

Good afternoon.
in a loop I compare int i with vector.size (), the compiler (VS) writes:
<: несоответствие типов со знаком и без знака
This is what I do:

vector<int> myvector; (потом я заполняю вектор, на цикле он заполнен)

for(int i = 0; i < myvector.size(); i++) // тут ругается, но продолжает работать, не ошибку выдает, просто предупреждение

I can't understand why there is a warning, doesn't size return an int?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question