Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main ()
  5. {
  6.     int tab[4]={0,1,2,3};
  7.  
  8.     auto f= [tab](){
  9.     for (int x: tab)
  10.         cout << x << endl;
  11.     };
  12.  
  13.     auto g= [&tab](){
  14.     for (int x: tab)
  15.         cout << x << endl;
  16.     };
  17.  
  18.     for (int i=0;i<4;i++)
  19.         tab[i]=5;
  20.  
  21.     f();
  22.     cout << endl;
  23.     g();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement