Advertisement
wavec022

lesson 6 pass by pointers

Aug 31st, 2020 (edited)
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. problem 1 on the worksheet-- when passing by pointers, the variables remain in scope so to speak so their values are changed
  2.  
  3. A struct is sorta like an object in python or something but not really it's basically just a bucket of crap
  4. see lsn6.c
  5.  
  6. pass pointers to structs-- printf("Name: %s\n", (*stu).name);
  7.  
  8. alternatively use the arrow-- printf("Name: %s\n", stu->name);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement