// // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // swap.c -- // // Author : Richard C. Bilson // Created On : Wed May 27 17:56:53 2015 // Last Modified By : Peter A. Buhr // Last Modified On : Mon Jan 4 11:32:25 2016 // Update Count : 5 // #include "fstream.h" forall( type T ) void swap( T *left, T *right ) { T temp = *left; *left = *right; *right = temp; } int main( void ) { int x = 1, y = 2; ofstream *sout = ofstream_stdout(); sout | x | ' ' | y | endl; swap( &x, &y ); sout | x | ' ' | y | endl; } // Local Variables: // // tab-width: 4 // // compile-command: "cfa swap.c fstream.o iostream.o iterator.o" // // End: //