### why is this code not working?

so i just want to know why this code is not working...i know the problem is in the function createUniqueVector...but after looking and looking i still can't say why is not working...

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263`` `````` #include std::vector CreateUniqueVector(const int* firstItem, const int* lastItem) { std::vector vReturn; int dup = 0; for (const int* curItem = firstItem; curItem != lastItem; ++curItem ) { for (const int* chkItem = firstItem; chkItem != lastItem ; ++chkItem) {if ((chkItem != curItem) && (*chkItem == *curItem)) { dup += 1; } if (dup = 0) { vReturn.push_back(*curItem); } } } return vReturn; } const int col = 5; int Array [6][5]= {{1,2,3,4,4,}, {7,4,5,7,6,}, {4,0,7,9,0,}, {4,5,5,9,0,}, {4,5,9,9,0,}, {1,1,1,1,1,}, }; int main() { std::vector iv; std::vector v; for (int i = 0; i < col ; i++) { iv = CreateUniqueVector(&Array [i][0], &Array[i][col-1] ); } for (int k = 0; k < iv.size(); k++) { v.push_back (iv[k]); } for (int i = 0; i
On line 17:
`if (dup = 0) // This assigns 0 ` -> `if (dup == 0) // Note: == `
On line 17 you use = instead of ==.
thats right coder777 and Peter87...those petty petty things...thanks guys
Topic archived. No new replies allowed.