You are exceeding array bounds on line 9. Should be < not <= , like you have on line 3. Hard to say what's wrong otherwise. There are 4 variables being used which aren't declared in the function: sum, sum2, avg and sD. I don't know their types (could affect accuracy and how operations are carried out) or the initial values of sum or sum2. Did you assign sum=0 and sum2=0 before calling the function?
Alrededor is also correct. If this is your function, then you have your internal variables declared globally.
This is very dangerous because if anyone attempts to use these labels, they will get unexpected results.
sum = 15;
sum += standardDeviation(myArray, size);
Here I would expect the sum to be 15 plus the standard deviation, but because it's a global label, it gets over-written by standardDeviation() without any clue why. In fact, even the standard deviation will be completely wrong because you don't set it to 0 in standardDeviation. The initial value for sum is 15, not 0 here so your calculation output will be completely wrong and it'll be a very tough thing to debug.
Originally When i had <= n on line 9 the sd was 32..... I didn't understand why until i had realize its was greater than or equal symbol i had inserted to which made a complete difference on the outcome.