Fix the compile-time errors in Example 19 and run it. There is a serious problem here! What is it?
/* This programme is meant to find the sum of two arrays/vectors and
print it out. */
#include <stdio.h>
int vecA[4] = {1,2,3,4}, vecB[4] = {90,91,92,93};
int *vecadd(int *a1, a2) {
int i, sum[4] ;
for (i = 0; i < 4; i++)
sum[i] = a1[i] + a1[i];
return *sum;
}
main() {
int ans[4];
ans = vecadd(vecA,vecB);
int i;
for (i=1; i < 4; i++)
printf("%d \n",ans[i]);
}
|
| ...previous | up (conts) | next... |