0

Attached is a tiny program in which the function F has as an argument the function pointer double (*f) (double). F returns the sum f(1)+f(2)+f(3)+f(4).

(Naturally, I have a much more interesting application in mind, but this simple example makes the point.) What I really want to do is replace f by a function of two variables, say g(x,y). Then I'd compute g(1,y) + g(2,y)+g(3,y)+g(4,y), so that F() would be a function of y. Is there a way to do this? Default values almost do the trick, but not quite.

Another totally unrelated question is this: can I download a text file right into this window? Then you wwouldn't have to open an attachment to see the program.