ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since b96d7c1 was
17c6c1c3,
checked in by Peter A. Buhr <pabuhr@…>, 6 years ago
|
add more paper examples
|
-
Property mode set to
100644
|
File size:
405 bytes
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | |
---|
3 | #define FIB_INIT { 0, 1 } |
---|
4 | typedef struct { int fn1, fn; } Fib; |
---|
5 | int fib( Fib * f ) { |
---|
6 | |
---|
7 | int ret = f->fn1; |
---|
8 | f->fn1 = f->fn; |
---|
9 | f->fn = ret + f->fn; |
---|
10 | |
---|
11 | return ret; |
---|
12 | } |
---|
13 | int main() { |
---|
14 | Fib f1 = FIB_INIT, f2 = FIB_INIT; |
---|
15 | for ( int i = 0; i < 10; i += 1 ) { |
---|
16 | printf( "%d %d\n", fib( &f1 ), fib( &f2 ) ); |
---|
17 | } |
---|
18 | } |
---|
19 | |
---|
20 | // Local Variables: // |
---|
21 | // tab-width: 4 // |
---|
22 | // compile-command: "gcc Fib.c" // |
---|
23 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.