I am using R.3.0.1 together with RStudio 0.97.551 on a 64bit Windows7 PC and I have begun to outsource a function to C/C++ using Rcpp. The function comp
You are making an elementary C/C++ error:
for(int i=0; i<n+1; i++)
will be accessed n+1 times, but you allocated n spaces.
n+1
n