Hi,
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?

Thanks.

Recommended Answers

All 2 Replies

= 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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.