//(c)Terminator
#include <stdio.h>
#define  N  6

#define tpl_array_rev(pfx, type) \
void array_rev##pfx(type* f, type* l){\
	type t;\
	type* a = f, *b = l - 1;\
	while(a < b){\
		t  = *a;\
		*a = *b;\
		*b = t;\
		++a;\
		--b;\
	}\
}

#define tpl_array_print(pfx, fmt, type) \
void print_array##pfx(FILE* hout, const type* f, const type* l){\
	for(; f != l; ++f){\
		fprintf(hout, fmt, *f);\
		fputc(' ', hout);\
	}\
	fputc('\n', hout);\
}

tpl_array_rev(i, int)
tpl_array_rev(d, double)
tpl_array_rev(c, char)

tpl_array_print(i, "%d",  int)
tpl_array_print(d, "%lf", double)
tpl_array_print(c, "%c",  char)



int main(void){
	char str[]    = "ABCDEF";
	int  iarr[]   = { 1, 2, 3, 4, 5, 6, }; 
	double darr[] = { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 };

	print_arrayc(stdout, str, str + N);
	array_revc(str, str + N);
	print_arrayc(stdout, str, str + N);
	putchar('\n');

	print_arrayi(stdout, iarr, iarr + N);
	array_revi(iarr, iarr + N);
	print_arrayi(stdout, iarr, iarr + N);
	putchar('\n');

	print_arrayd(stdout, darr, darr + N);
	array_revd(darr, darr + N);
	print_arrayd(stdout, darr, darr + N);
	return 0;
}
