If you want to pretend non-numeric entries are zero, change the test to: <code>
if (1 != sscanf(cur, "%lf", &x)) { x = 0; }
</code> and apply Welford's algorithm regradless of sscanf()'s success or failure.