I'm trying to compare elements in two different vectors.

I wrote this:

if (a = b[j])
same = true;

and the compiler said this about the first line:

assignment of read-only location

What does "assignment of read-only location" mean?


= is the assignment operator, not equivalence test operator, and you probably declared a as const.

Thanks for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.