source: src/examples/swap.c @ 0f19d763

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 0f19d763 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 365 bytes
Line 
1extern "C" {
2    int printf( const char *, ... );
3}
4
5forall( type T )
6void swap( T *left, T *right ) {
7    T temp = *left;
8    *left = *right;
9    *right = temp;
10}
11
12int main() {
13    int x = 1, y = 2;
14    printf( "%d %d\n", x, y );
15    swap( &x, &y );
16    printf( "%d %d\n", x, y );
17}
18
19// Local Variables: //
20// compile-command: "../../bin/cfa swap.c" //
21// End: //
Note: See TracBrowser for help on using the repository browser.