Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. typedef struct {
  5. int x;
  6. float y;
  7. char s[256];
  8. } my_struct_t;
  9.  
  10. void f1(my_struct_t m) {
  11. m.x = 10;
  12. }
  13.  
  14. void f2(my_struct_t* m) {
  15. m->x = 10;
  16. }
  17.  
  18. int main() {
  19. my_struct_t t1;
  20. t1.x = 1;
  21. t1.y = 2;
  22. strncpy(t1.s, "3", 256);
  23. my_struct_t t2;
  24. t2.x = 4;
  25. t2.y = 5;
  26. strncpy(t2.s, "6", 256);
  27.  
  28. t1 = t2;
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement