source: src/examples/min.c @ 09a9a8b

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 09a9a8b was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 568 bytes
Line 
1extern "C" {
2    int printf( const char *, ... );
3//#include <stdio.h>
4}
5
6forall( type T | { int ?<?( T, T ); } )
7T min( const T t1, const T t2 ) {
8    return t1 < t2 ? t1 : t2;
9}
10
11int main() {
12    char c;
13//    c = min( 'z', 'a' );
14//    printf( "minimum %d\n", c );
15    int i;
16    i = min( 4, 3 );
17    printf( "minimum %d\n", min( 4, 3 ) );
18    float f;
19    f = min( 4.0, 3.1 );
20    printf( "minimum %g\n", f );
21    double d;
22    d = min( 4.0, 3.2 );
23    printf( "minimum %g\n", d );
24}
25
26// Local Variables: //
27// compile-command: "../../bin/cfa min.c" //
28// End: //
Note: See TracBrowser for help on using the repository browser.