title: Why I can't call max function in C++?
body: <p>After allocating an array in the heap.I'm trying to make a function max to find the biggest number in an array with pointers, but it gives me this error:-In function ‘int main()’:
  error:max,cannot be used as a function.
    Here is the code:</p>
  
  <pre><code>     #include&lt;iostream&gt;
       using namespace std;
  
      int max(int *v,int n){
         int i,max=0;
          for(i=1;i&lt;=n;i++){
              if(*(v+i)&gt;max)
                  max=v[i];
          } 
          return max;
      }
  
       int main(){
       int *v,n,i;
  
    //read n    
       cout&lt;&lt;"Number of elements  ";
       cin&gt;&gt;n;
  
       v = new int[n];
  
      //read elements
      cout&lt;&lt;"Array Ellements:";
      for(i=1;i&lt;=n;i++){
          cin&gt;&gt;v[i];
      }
  
      // output array elements   
      for(i=1;i&lt;=n;i++){
          cout&lt;&lt;v[i];
          if(i&lt;n)
          cout&lt;&lt;",";
  
      }
      cout&lt;&lt;endl;
  
       //max store the biggest number in the array
       int max;
       max = max(v,n);
  
          return 0;
      }
  </code></pre>