[求助]大家来看看啊!!
大家帮个忙利用指针形式编写一个程序,求两个向量的内积
#include <stdio.h>
#define SIZE 10
int main(void){
int ar_a[SIZE];
int ar_b[SIZE];
int n,*pa,*pb;
int sum=0;
printf("How many elements you want!\n");
scanf("%d",&n);
for(pa=ar_a,pb=ar_b;pa<ar_a+n;pa++,pb++){
printf("insert elements to arry 1 !\n");
scanf("%d",pa);
printf("insert elements to arry 2 !\n");
scanf("%d",pb);
sum+=(*pb)*(*pa);
}
printf("Out:sum=%d\n",sum);
return 0;
}