Accelerometer acquisition, filtering and treatment on Pic
Assuming you are sampling at a fixed time step, called \$\Delta\$, and \$t_n\$ denote your sample times (i.e. \$t_n = n \Delta\$) then a traditional estimate of the velocity is
$$v(t_{n}) \sim \sum_{k=0}^{n-1} a(t_k) \Delta$$
where \$a(t_k)\$ is the acceleration value at time \$t_k\$ as sampled by your accelerometer.  It sounds like you are also assuming the initial conditions that \$v(t_0) =0\$ and \$p(t_0) = 0\$.

Applying this idea again to get the position via integrating the computed velocity we obtain
$$p(t_{n}) \sim \sum_{k=0}^{n-1} v(t_k) \Delta \sim \sum_{k=0}^{n-1}\sum_{i=0}^{k-1} a(t_i) \Delta^2.$$

This latter summation simplifies a bit to
$$\sum_{k=0}^{n-1}\sum_{i=0}^{k-1} a(t_i) \Delta^2 = \sum_{i=0}^{n-2}(n-1-i)a(t_i)\Delta^2 = \left(\sum_{i=0}^{n-3}(n-2-i)a(t_i)\Delta^2\right) + \sum_{i=0}^{n-2}a(t_i)\Delta^2.$$

Now if you notice the bit in parenthesis is our estimate of \$p(t_{n-1})\$ then you see we get the recursive formula \$p(t_{n}) = p(t_{n-1}) + \sum_{i=0}^{n-2} a(t_i)\Delta^2\$.  This allows us to easily compute \$p(t_{n})\$ by keeping track of two (and only two) values:
\$p(t_{n-1})\$ and an auxiliary variable \$s_n = \sum_{i=0}^{n-2} a(t_i) \Delta^2\$.  Note we have the recursive formulas $$s_n = s_{n-1} + a(t_{n-2})\Delta^2$$
and
$$p(t_n) = p(t_{n-1}) + s_n.$$

Your computation algorithm will go something like this:

1) Initial: \$p(t_0) = p(t_1) = 0\$. \$s_2 = a(t_0)\Delta^2\$.

2) At stage \$n\$: \$s_n = a(t_{n-2})\Delta^2 + s_{n-1}\$; free the memory containing \$s_{n-1}\$; \$p(t_{n}) = p(t_{n-1}) + s_{n}\$. 

3) Repeat.

A few small remarks: You will probably want to delay multiplying everything by \$\Delta^2\$ until the end.  You will have to experiment with the size of floating point data type you need so as not to overflow it. You need not use separate variables for \$s_n\$; in XC you would have a statement similar to \$s \hspace{5pt} +\hspace{-5pt}= a(t_{n-2})\Delta^2\$.