pass by reference

hello everyone..i actually have a doubt in C programming but since this part of the code is similar to C++, im posting it here in this forum.
any form of help will be appreciated.

this is my code:

#include <stdio.h>
#include <math.h>
#include <stdlib.h>


int main()
{
int i=0,a;
double points[100][1];
double s1, s2, s3, m1, m2;
double *sumX2=&s1, *sumY2=&s2, *sumXY=&s3, *meanX=&m1, *meanY=&m2;
double ObtainStatistics(double,int);
double trendLine(int);

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

while(1)
{
fscanf(fin, "%lf %lf", &points[i][0],&points[i][1]);
if(feof(fin))
break;
i++;
}

fclose(fin);

for(a=0;a<i;a++)
printf("%lf %lf\n", points[a][0], points[a][1]);

printf("Value of n is: %d\n", i);

ObtainStatistics(points[i][1],i);


return 0;
}
double ObtainStatistics(double y[][],int x)
{
int b;

for(b=0;b<x;b++)
{
sumX2+= s;
sumY2+=y;
*sumXY+=(s*y);
*meanX= s1/x;
*meanY= s2/x;
}
}


but when i compile, there is this error coming out, reading, "undeclared identifier". this comes in the function called ObtainStatistics.
the variables, sumX2, sumY2, sumXY..and so on are giving me errors.

I am not sure why i get these errors since i have already declared these variables upfront.
if anyone knows what is wrong with my code, pls help
thanks
The function definition is put after main. You need to let it know that there is such a function to use by putting the function name before main.
double ObtainStatistics, double y[][], int x);
(just put that before main and code what it does after main)
hey!
thanks for the help, but the error still exists. I took the function, double ObtainStatistics, (double y[][], int x); and put it before main and left the rest of the code as it was.
Still, the compiler is no able to identify the variables,sumX2, sumY2, sumXY..and so on.
Ah sorry... I misread the question. I don't really know C much but i'd pretty much guess that it's because the variables are only declared in main() and the function has no idea what they are.
Topic archived. No new replies allowed.