Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- typedef struct {
- int x;
- float y;
- char s[256];
- } my_struct_t;
- void f1(my_struct_t m) {
- m.x = 10;
- }
- void f2(my_struct_t* m) {
- m->x = 10;
- }
- int main() {
- my_struct_t t1;
- t1.x = 1;
- t1.y = 2;
- strncpy(t1.s, "3", 256);
- my_struct_t t2;
- t2.x = 4;
- t2.y = 5;
- strncpy(t2.s, "6", 256);
- t1 = t2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement