So i decided to solve a problem from some C book. Handled all the errors gcc compiler told me to handle, so now program compiles with no error. However, when I run the executive, after the input, it says "Segmentation fault". What does it mean and how do I fix it?
I supposed that is because I implement discrete function to count the sum, then tried to wrtie a code in just main(). it worked okay, but still.
I am curious of what are the reasons of this mistake, and why it appears when i decide to use function?
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
double summation(long* N);
int main(void)
{
    printf("summation of squares of first N numbers\n");
    printf("enter N\n");
    long* N;
    *N = 0;
    scanf("%li\n",N);
    double su;
    su = summation(N);
    printf("The summ equals %.lf\n", su);
    return 0;
}
double summation(long* N)
{
    double S = 0;
    int i;
    for (i = 1; i <= *N; i++)
        S = S + pow(i, 2);
    return S;
}
thanks in advance.
 
    