title: C program to find the function name of a c file
body: <p>I'm programming in C (Linux OS). I have to read a file, check for functions in that file and print the corresponding function name. So far, I have programmed to identify the functions using depth calculation of '{'. I know that <code>__FUNCTION__</code> preprocessor directive is used for printing current file's function name. Similarly, is there any preprocessor directive for finding function names of the file we read? I'm not concerned about any specific tools. I want to get it programmed. Kindly guide me. Thanks in advance.</p>
  
  <p>I have tried to implemented this code.This function takes the line( which is coming before '{') as argument.</p>
  
  <pre><code>void ffname(char line[100])
  {
      int i,j,m,n,f=0;
      char dt[10],fname[28];
      char s[5][10]={"int","void","struct","char","float"};
      dt = strtok(line," ");
      for(i=0;i&lt;5;i++)
      {
          m=strcmp(dt,s[i]);
          if(m==0)
          {
              f=1;
              n=strlen(dt);
          }
      }
      if(f)
      {
          for(i=n+2,j=0;i&lt;strlen(line);i++,j++)
          {
              if(line[i] == '*')
                  i++;
              while(line[i] != '(')
              {
                  fname[j]=line[i];
              }  
          }
      }
  }
  </code></pre>
  
  <p>I don't know that this code is correct. Shall i use in this way? is there any option to find the function name?</p>