void fileheader(char fn,int *a )
fp=fopen(fn,"r");// is fn null-terminated?
while((c=getc(fp)) != '\n'); //moves filepointer pass leading newlines
while ((c=getc(fp)) == '#')//while 1st char in row is '#' ---indentation was misleading
while ((c=getc(fp)) != '\n');// move to next row
ungetc(c,fp);//unget last read??, why?? .. probably points at newline now
fscanf(fp,"%d%d%d",&a,&a,&a);// is "a" defined as an array of at least 3 int? Are you reading past end of file?