Advertisement
193030

Parameters passing - Call by adress structure

Aug 9th, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. struct Rectangle
  5. {
  6.     int length;
  7.     int breadth;
  8.    
  9. };
  10. void changeLength( struct Rectangle *p, int l)
  11. {
  12.     p->length = l;
  13. }
  14. int main()
  15. {
  16.     struct Rectangle r = {10,20};
  17.     changeLength(&r, 20);
  18.     cout << r.length << endl;
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement