Just to start with :
In main:
int n, a, b; // a & b are not initialized
.
scanf("%d",&n); // Think what is the use of n here.
.
printf("%d",inner_product(&a,&b,n));
/* You passed address of a and b, this is OK but the value they
* store is indeterminate as per the standard
*/
In the function
for (i=0; i<size; ++i)
sum += *(a+i) * *(b+i); // Accessing the memory out of bound for size>1 behavior is undefined
// Remember you have only two pointers which you can legally dereference ie a and b
2
solved inner product function without using array subscripting in C [closed]