Skip to content
This repository has been archived by the owner on Feb 13, 2022. It is now read-only.

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dostuffthatmatters committed Jan 14, 2021
1 parent 684f525 commit 0041ae0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tutorial-08/examples/live_8.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ struct Point {
float z;
};

struct Point inc_10(struct Point s) {
s.x += 10;
s.y += 10;
s.z += 10;
return s;
}

void inc_10_r(struct Point *s) {
s->x += 10;
s->y += 10;
s->z += 10;
}

int main() {

struct Point a;
Expand All @@ -21,4 +34,9 @@ int main() {
printf("add y = %p\n", &(a.y));
printf("add z = %p", &(a.z));

}
printf("a.x = %f\n", a.x);
a = inc_10(a); // Please avoid that!!
printf("a.x = %f\n", a.x);
inc_10_r(&a);
printf("a.x = %f\n", a.x);
}

0 comments on commit 0041ae0

Please sign in to comment.