//
// 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.
//
// square.c -- 
//
// Author           : Richard C. Bilson
// Created On       : Wed May 27 17:56:53 2015
// Last Modified By : Peter A. Buhr
// Last Modified On : Wed May 27 18:43:34 2015
// Update Count     : 2
//

extern "C" {
#include <stdio.h>
}

forall( type T | { T ?*?( T, T ); } )
T square( T t ) {
	return t * t;
}

//char ?*?( char a1, char a2 ) {
//	return (char)( (int)a1 * (int)a2 );
//}

int main() {
	char c = 5;
	short int s = 5;
	int i = 5;
	float f = 5.0;
	double d = 5.0;
//	printf( "result of square of 5 is %d\n", (char)square( c ) );
	printf( "result of square of 5 is %d\n", square( s ) );
	printf( "result of square of 5 is %d\n", square( i ) );
	printf( "result of square of 5 is %f\n", square( f ) );
	printf( "result of square of 5 is %f\n", square( d ) );
}

// Local Variables: //
// tab-width: 4 //
// compile-command: "cfa square.c" //
// End: //
