what is wrong with my code that i keep getting this error "error C2440: '=' : cannot convert from 'double' to 'double *'"(adsbygoogle = window.adsbygoogle || []).push({});

i am new to c and very weak in pointer.

#include<stdio.h>

//Function Prototypes//

int read(double pointco[][2]);

void obtainStatistics(double pointco[][2],int n,double *a);

//======================start of codes===========================//

void main(){

double pointco[100][2];

int i,j,n,p;

double temp[4]={0};

n=read(pointco);

for(p=0;p<5;p++){

printf("%lf %lf %lf \n",obtainStatistics(pointco,n,&temp[p])); //%lf %lf

}

for (i=0;i<n;i++){

for(j=0;j<2;j++){

printf("%lf",pointco[j]);

}//for j

printf("\n");

}//for i

}//main close

//======================End of main=============================//

int read(double pointco[][2]) {

int i,j,n=0;

FILE *fp = fopen("points.txt", "r");

for(i=0;i<100;i++){

for(j=0;j<2;j++){

if(fscanf(fp,"%lf", &pointco[j] ) != EOF)

n++;

}//j

}//i

n=n/2;

fclose(fp);

return n;

}//close read

//======================Read point.txt========================//

void obtainStatistics(double pointco[][2],int n,double *a)

{

int i,j,k;

double temp1,temp2;

for(i=0;i<n;i++){

for(j=0;j<1;j++){

a[0]+=pointco[j];

}

}//find sum of all x

for(i=0;i<n;i++){

for(j=1;j<2;j++){

a[1]+=pointco[j];

}

}//find sum of all y

for(i=0;i<n;i++){

for(j=0;j<1;j++){

temp1=pointco[j];

for(k=1;k<2;k++){

temp2=pointco[k];

a[2]+=temp1*temp2;

}//k

}//j

}//i//find sum of x*y

return;

}

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Pointer error need help error C2440: '=' : cannot convert from 'double' to 'double *'

**Physics Forums | Science Articles, Homework Help, Discussion**