So far I have an array that says this:
char *myarray=("hello")
and a vector that says this:
vector<string> myvector
myvector.push_back("hello")
however I cannot compare the contents of the vector to the array and vice versa.
if (myarray[0] = myvector[0]) doesnt work - the compiler says it cannot convert.
So how do I check if myarray[0]=myvector[0]????
Help I'm going mad!
It cannot convert since myarray is an array of char
while myvector is an 'array' of string
.
you can compare if(myvector[0] == myarray) // NOTE: ==(compare) and not =(assign)
Thank you coder. I didnt want to convert it, just compare the contents of the two. I tried what you suggested and it worked perfectly!
Thank you for also explaining the difference between the compare symbol (==) and the assign symbol (=).