I'm writing the C program to find the function and calculate the number of lines of a function in C file and I am storing it into a structure. I've given my codes below.

#include #include #define SIZE 1024 struct fundetails { int nooflines; char *funcname; }s[20]; char *ffname(char *line) { int i=1,j=0; char *dt; char name[SIZE]; strtok(line,"("); dt = strchr(line,' '); if(dt[i] == '*') i++; while(dt[i] != '\0') { name[j]=dt[i]; i++; j++; } name[j] ='\0'; return name; } int main(int argc, char **argv) { if(argc < 2) { printf("Give the filename \n"); printf("Usage: %s filename\n", argv[0]); return -1; } int i, lines =0, funlines =0,count =0, fn =0, flag =0, size=0,emptyflag=0; char c[SIZE],b[SIZE]; char *fname; FILE *fd; fd = fopen(argv[1],"r"); while(fgets(c,SIZE,fd)) { emptyflag=0; lines++; size = strlen(c); if(size == 1 && (strcmp(c,"\n"))== 0) emptyflag=1; for(i=0;i