//Dotp4.c Multiplies two arrays, each array with 4 numbers 

int dotp(short *a, short *b, int ncount); //function prototype
#include <stdio.h>              //for printf
#include "dotp4.h" 			    //data file of numbers
#define count 4                 //# of data in each array
short x[count] = {x_array};	    //declaration of 1st array
short y[count] = {y_array};     //declaration of 2nd array

main()
{
  int result = 0;    			//result sum of products
  
  result = dotp(x,y,count);		//call dotp function
  printf("result = %d (decimal) \n", result); //print result
}

int dotp(short *a, short *b, int ncount) //dot product function
{                        		 
  int sum = 0;                  //init sum
  int i; 
  
  for (i = 0; i < ncount; i++) 
     sum += a[i] * b[i];       	//sum of products
  return(sum);                  //return sum as result
}