Passing list reference to other function

Hi all,

int main(){

list<int> list1 = {1, 0, 0, 1};

for (auto& elem : list1)

xor1(1,elem); // Identifier elem is undefined.

How to pass the list1 element to xor1 function.

Thank you!
Your random lines taken from whatever code you have don't tell us the whole story.

If you've got a <20 line test program demonstrating your issue, then post it "as is".
It removes ALL of the guessing on our part, and will get you answers quicker.
Registered users can post here. Sign in or register to post.