title: Use function pointer in struct - C compiler
body: <p>I found an answer how to make function pointer in struct but I am still curious about 
  its operation. Can anybody explain this clearly? </p>
  
  <p>Here is my question, </p>
  
  <p>This code runs properly but...</p>
  
  <pre><code>char func_1(void);    
  char func_2(char);
  
  struct mStruct
  {
      char name[100]; 
      int age;
      char (*func_1)(void);
      void (*func_2)(char);
  };
  
  void init_struct(struct mStruct *pStruct)&lt;-why this void function is necessary? 
  {
      if(pStruct == NULL) {
          pStruct = malloc(sizeof(struct mStruct));
      }
  
      (*pStruct).age = 25;
      (*pStruct).func1 = &amp;func1;
      (*pStruct).func2 = &amp;func2;
   }
  
   char func_1(void)
   {
     ... ;
    }    
   char func_2(char)
   {
     ... ;
    }
  </code></pre>
  
  <p>I already tried to eliminate the <code>init_struct</code> function, but all tries failed.  My gcc compiler only accepts it as above.  Does anybody know another way to initialize the struct without using a function
  or why it is only acceptable as a <code>void</code> function?</p>