passing array elements to a function in c