what is segmantion fault and why this programme showing segmantion fault :         #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    int main()
    {
        char c[1000];
        int tnum,a,b,d;
        char *n;
        scanf("%d",&tnum);
        while(tnum!=0)
        {
    
            scanf("%[^\n]s",c);
    
            n = strtok(c," ");
    
            a= atoi(n);
    
            n = strtok(NULL," ");
            b=atoi(n);
    
            n = strtok(NULL," ");
            d = atoi(n);
    
            printf("%d\n", a*b*d);
            tnum--;
        }
        return 0;
    }


here i try to get token from a string ,separating by space. 
But i m getting Segmantion fault.
if i run this programme without while loop. it is fine..but why..please can anyone explain? 
