invalid conversion from ‘int (*)(int)’ to ‘int’ error?
<p>I am learning C++ and one of the programs was for a random number generator.<br>
Once I wrote the program I got the following errors: </p>

<pre><code>dice.cpp: In function ‘int main()’:
dice.cpp:18: error: pointer to a function used in arithmetic
dice.cpp:18: error: invalid conversion from ‘int (*)(int)’ to ‘int’
</code></pre>

<p>Here is my code:</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;cmath&gt;
#include&lt;stdlib.h&gt;
#include&lt;time.h&gt;
using namespace std;
int randn(int n);
int main()
{
  int q;
  int n;
  int r;
  srand(time(NULL));
  cout&lt;&lt;"Enter a number of dice to roll: ";
  cin&gt;&gt;n;
  cout&lt;&lt;endl;

  for (q=1; q&lt;=n; q++)
  {
    r=randn+1;  // &lt;-- error here
    cout&lt;&lt;r&lt;&lt;endl;
  }
  return 0;
}

int randn(int n)
{
  return rand()%n;
}
</code></pre>

<p>What could be the problem?</p>
