Menu

[Solved] C Programming Hard Time Understanding Happening Function Vecsum Could Someone Explain Poin Q37264379

C Programming:

Having a hard time understanding what is happening in thefunction vecsum. Could someone explain how the pointers are workingin this code? Thanks!

|

|

#include <stdio.h>
#define SIZE 6

int vecsum(int *x, int y[], int size);
int main(void){
   int x[SIZE], y[SIZE], i=6;

   printf(“Function returns%dn”,vecsum(x,y,i-1));
   return 0;
}

int vecsum (int *x, int y[], int size){
   int i, sum;
  
for(i=0;i<size;i++){
      *(x+i)=2*i;            
       y[i]=*(x+i)-1;}

   for(i=0, sum=0;i<size;i++)  
       sum+=*(x+i) * y[i];

   return (sum);
}

Expert Answer


Answer to C Programming: Having a hard time understanding what is happening in the function vecsum. Could someone explain how the … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *