Implementation help with difference equation
I assume what you want is a digital filter. Each time you collect a
sample x[n], you feed it to the filter, and the filter returns the
corresponding y[n] given by
y[n] = 0.4142 y[n−1] + 0.2929 x[n−1]
In order to compute this result, the filter has to remember the previous
value of its input (x[n−1]) and of its output (y[n−1]). You need two
variables for storing this information, which I would call x1 and
y1. Note that the filter doesn't need to remember anything older than
that, so there is no use in storing more data. No need to create arrays
for storing the whole x and y sequences. Since the values have to be
remembered between calls to the filter, they have to be global
variables. Alternatively, they can be local to the filter provided they
have the static qualifier.
Once you have those two variables, you just have to apply the formula to
compute y[n]:
static float x1, y1;  // x[n-1], y[n-1]
float y = 0.4142 * y1 + 0.2929 * x1;

There is just one more thing to take care of before returning y: the
variables x1 and y1 have to be updated in order to hold the
current values of the filter's input and output. This way, next time
the filter is called, the values will have the previous values, as
expected. The whole filter is then
/*
 * Single pole low-pass filter.
 * transfer function:   H = 0.2929 / (z - 0.4142)
 * recurrence relation: y[n] = 0.4142 y[n-1] + 0.2929 x[n-1]
 */
float filter (float x) {
    static float x1, y1;  // x[n-1], y[n-1]
    float y = 0.4142 * y1 + 0.2929 * x1;
    x1 = x;
    y1 = y;
    return y;
}

A few notes:

x1 and y1 are implicitly initialized to zero. This is common
practice, but a fact you should be aware of. If it doesn't fit your
needs, add an explicit initialization to the definition of the
variables.

If you need multiple instances of the same filter, storing the state
as static locals would not work. Instead, the filter should take a
pointer to a “state object” as an extra parameter. If you want to do
this the “object-oriented” way, the pointer would be called this.

Why use x[n−1] instead of x[n]? This just adds an artificial delay to
the filter without affecting its low-pass performance. When designing
low-pass filters, it is common to prefer short delays, everything
else being equal.