
# C code :

void arsim(double *x, long *n)
{

	long i;

	for(i=1; i<*n; i++)
	
		x[i] = x[i]*x[i];

				}



In terminal : 




cd /home/subho/Desktop/soft/C_R_1

R CMD SHLIB 1.c 



In R:



setwd("/home/subho/Desktop/soft/C_R_1")

dyn.load("1.so")

.C("arsim",x=as.double(rnorm(5)),n=as.integer(5))




