calculate average

I have a file which is
2
3
4
5
6
6

so i am writing program in C to calculate mean..

#include<stdio.h>
#include<string.h>
#include <math.h>
double CALL mean(int n , double x[])
main (int argc, char **argv)
{
char Buf[200],SEQ[100];
int i;
double result = 0;
FILE *fp;
fp=fopen(argv[1],"r");
while(fgets(Buf,20,fp))
{
sscanf(Buf,"%s",SEQ);
x=SEQ;
//printf("%s\n",SEQ);
}
fclose(fp);
{
for (i = 0; i < n; i++) result += x[i];
result /= n;
return result;
printf("%f", result);
}
}

But it is showing segmentation fault
any solution?

Please use code tags otherwise this program is hard to read and don't post parts oif it. Post the entire program and run it through gdb to see the erroneous line.

No CODE TAGS [ c o d e] ... [ / c o d e ] without spaces. -- jim mcnamara

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

main (int argc, char **argv)
{
  char Buf[200],SEQ[100];
  int i,n;
  double x[], mean,result = 0;
  FILE *fp;
  fp=fopen(argv[1],"r");
  while(fgets(Buf,20,fp))
        {
        sscanf(Buf,"%s",SEQ);
        x=getc(SEQ);

        }
  fclose(fp);
 {

    for (i = 0; i < n; i++) result += x;
    result /= n;
    return result;
    printf("%f", result);
  }
}

output of this program
mean.c: In function �main�:
mean.c:11: error: array size missing in �x�
mean.c:17: warning: passing argument 1 of �_IO_getc� from incompatible pointer type
mean.c:17: error: incompatible types in assignment

You have a large number of errors in the code. You need to work on it until it compiles with NO errors or warnings.