Declaration of a function inside a function


Many time since my last post…

Well, I don’t understand this:

double f1(a,b,c,fxn)
double fxn();
double *a, *b, *c;

instructions of f1


Is from a program in C, not from ROOT, but I think anyone here can help me.

Here I put the class vegas.c that is the VEGAS algorithm to do numerical integration.

My problem is that I don’t know where and how I have to define and/or declare my function fxn that I want to integrate. I’ve looked at many sites searching help, but I haven’t found anything of interest.

If anyone has a newer implementation of this algorithm prepared to run in ROOT or any site to download I’d be very happy :smiley: .

vegas.c (12.5 KB)

Your C code looks like Fortran and cannot be compiled in C++.
In particular you must declare your function prototypes.
I made many changes in your code (make a diff with your original version). see attachment.
We have a multi-dimensional integration function in class TF1.

vegas.C (13.2 KB)