Changeset 0b8cd722 for translator/examples/swap.c
- Timestamp:
- Jan 8, 2015, 2:37:47 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 6c3744e
- Parents:
- 17cd4eb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/examples/swap.c
r17cd4eb r0b8cd722 4 4 5 5 forall( type T ) 6 Tswap( T *left, T *right ) {6 void swap( T *left, T *right ) { 7 7 T temp; 8 8 temp = *left; 9 9 *left = *right; 10 10 *right = temp; 11 return *right;12 11 } 13 12 … … 15 14 int x = 1, y = 2; 16 15 printf( "%d %d\n", x, y ); 17 int w; 18 w = swap( &x, &y ); 19 printf( "%d %d %d\n", w, x, y ); 16 swap( &x, &y ); 17 printf( "%d %d\n", x, y ); 20 18 } 21 19
Note: See TracChangeset
for help on using the changeset viewer.