Error array value after passed to a function
sizeof counts bytes. the type of your array is int. sizeof of the int array of length 5 is 10 bytes. your for loop goes to i &lt; 10 and reads after the 5th item of the array.