fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int greet(){
  5. cout<<"hello asha";
  6. return 0;
  7. }
  8. int add(int a ,int b){
  9. return a+b;
  10. }
  11. int main() {
  12.  
  13. //reference variable
  14.  
  15. // int x=4;
  16. // int y=x; // copy of x variable (here x and y are independent.)
  17. // y--;
  18. // x++;
  19. // cout<<x<<endl<<y;
  20. int x=7;
  21. int &y=x; // y is reference to x . Its like you gave a second name to x . x and y are now ek jism ek aatma.
  22. //that is why there address will also be same.
  23. // x++;
  24. // y++;
  25. // cout<<x<<endl<<y;
  26. // cout<<&x<<endl; // address of x variable: 0x7ffd868651e4
  27. // cout<<&y<<endl; //address of y variable: 0x7ffd868651e4
  28.  
  29. // int z=greet();
  30. int a ,b;
  31. cin>>a>>b;
  32. int k=add(a,b);
  33. cout<<k;
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5284KB
stdin
45 54
stdout
99