title: Adding the values of two pointers and saving the addition into another pointer
body: <p>I'm a beginner but what I'm trying to do is getting the value of two pointers and saving the 'action' of their addition. I thought pointer to function would work  but can't find how to initialize a pointer to a function with it's parameters. Something like this.</p>
  <pre><code>int foo(int *a, int *b){return *a + *b;}
  //main
  
  int *a = new int, *b = new int;
  *a = 10;
  *b = 20;
  int (*ab)(int *a, int *b) = foo(a, b); // here I try to save it like it is but I can't.
                                         // otherwise It would be like calling a function to get the result,
                                         // my idea was to save it to a variable.    
  std::cout &lt;&lt; ab &lt;&lt; std::endl;
  
  *a = 2000;
    
  std::cout &lt;&lt; ab &lt;&lt; std::endl; // so the 'value' of ab would change here.
  </code></pre>
  <p>I was trying to think this to avoid having to change values that depend on one another. Maybe there's an easier way but I haven't got to it yet.</p>