title: C: Declare volatile pointer to function
body: <p>How to declare a pointer to function in C, in order that the pointer itself is volatile.</p>
  
  <pre><code>static void volatile (* f_pointer)(void*);
  
  static void (volatile * f_pointer)(void*);
  
  static void (* volatile f_pointer)(void*);
  </code></pre>
  
  <p>Why I asking this? I read at <a href="http://wiki.answers.com/Q/Volatile_example_code_sample_coding_of_volatile_pointer">http://wiki.answers.com/Q/Volatile_example_code_sample_coding_of_volatile_pointer</a> about volatile pointers. </p>
  
  <p>There are sometimes problems with volatile pointers and pointer-to volatile:</p>
  
  <blockquote>
    <p>Now, it turns out that pointers to
    volatile variables are very common.
    Both of these declarations declare foo
    to be a pointer to a volatile integer:</p>
  </blockquote>
  
  <pre><code>volatile int * foo; 
  int volatile * foo; 
  </code></pre>
  
  <blockquote>
    <p>Volatile pointers to non-volatile variables are very rare (I think I've used them once), 
    but I'd better go ahead and give you the syntax: </p>
  </blockquote>
  
  <pre><code>int * volatile foo;
  </code></pre>
  
  <p>So, I want to get a volatile pointer to function not a pointer to "volatile"  function.</p>
  
  <p>Thanks</p>