All pastes #1205360 Raw Edit

vikky

public text v1 · immutable
#1205360 ·published 2008-09-18 22:31 UTC
rendered paste body
#include <stdio.h>#define DELTA 0.01static float test_func(float x){	return x*x;}static float integrate(float (*func)(float),float ll, float ul){	float set, result;	result=0;	for(set=ul;set>=ll;set-=DELTA){		result+=(*func)(set)*DELTA;	}	return result;}//static float (*func)(float) = test_func;int main(int argc, char **argv){	float test;	test = integrate(test_func,1,4);	printf("ans=%f\n",test);	return 0;}