mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 23:18:48 +00:00
add struct example
This commit is contained in:
19
examples/c/struct4.c
Normal file
19
examples/c/struct4.c
Normal file
@@ -0,0 +1,19 @@
|
||||
int nonce = 1; // For random input
|
||||
|
||||
struct Foo
|
||||
{
|
||||
int x;
|
||||
};
|
||||
|
||||
struct Foo f()
|
||||
{
|
||||
struct Foo x;
|
||||
x.x = nonce;
|
||||
return x;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int x = f().x;
|
||||
return x;
|
||||
}
|
||||
Reference in New Issue
Block a user