Question.3
Two lambdas capture the same variable differently:
int count = 10; auto by_val = [count]() { return count; }; auto by_ref = [&count]() { return count; }; count = 99; printf("%d %d", by_val(), by_ref());
What is the output?
Select Answer
99 99
10 99 -- by_val captured a copy of count (10) at creation time; by_ref captures a reference that sees the updated value (99)
10 10
99 10