What seems to be the problem with this macro for plotting data points from two arrays?

In the macro I have attached below, what I intend to do is calculate value of pi using monte-carlo simulation for various values of “n”. Currently, I have five different values of n and it will give me five different values of pi. I want to store those values of pi in an array called Pi_val and then plot nTotal against Pi_val. It does not work and gives me

Can’t call TGraph::TGraph(5,nTotal,Pi_val) in current scope montecarloforum2.C:

Could anyone help me figure this out? I honestly think that it might be just a mistake in coding than my inability to understand ROOT TGraph or maybe both. Any help would be very much appreciated.

ROOT Version: 5.34/38
Platform: Ubuntu
Compiler: Not Provided

montecarloforum2.C (863 Bytes)


double nTotal[5] = {100,1000,10000,100000,1000000}; //array

@Wile_E_Coyote, oh okay, both the sets should have the same data types.