mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 23:18:48 +00:00
Update skeleton
This commit is contained in:
24
examples/c/struct3.c
Normal file
24
examples/c/struct3.c
Normal file
@@ -0,0 +1,24 @@
|
||||
struct Sub {
|
||||
long m1;
|
||||
long m2;
|
||||
long m3;
|
||||
long m4;
|
||||
};
|
||||
|
||||
struct Big {
|
||||
struct Sub m1;
|
||||
struct Sub m2;
|
||||
struct Sub m3;
|
||||
};
|
||||
|
||||
struct Big foo(struct Big p1) {
|
||||
struct Big r = p1;
|
||||
r.m1.m1 = 10;
|
||||
return r;
|
||||
}
|
||||
|
||||
int main() {
|
||||
struct Big a = {{1, 2, 3, 4}, {2, 3, 4, 5}, {3, 4, 5, 6}};
|
||||
struct Big r = foo(a);
|
||||
return r.m1.m1 == 10;
|
||||
}
|
||||
Reference in New Issue
Block a user