title: #[Error] invalid conversion from 'int*' to 'int'
body: <p>I need little help. When I compile my code it give me this error:</p>
  
  <blockquote>
    <p>[Error] invalid conversion from 'int*' to 'int' [-fpermissive]</p>
  </blockquote>
  
  <p>My code is given below, please point out the mistake:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class ptrArry{
  private:
      int *ptr;
      int MaxSize;
  public:
      ptrArry(){
          ptr=NULL;
          MaxSize=2;
          for(int i=0; i&lt;MaxSize; i++){
              *(ptr+i) = new int[MaxSize];
          }
      }
      void setArry(int val){
          for(int i=0; i&lt;MaxSize; i++){
              for(int j=0; j&lt;MaxSize; j++){
                  cout&lt;&lt;"i="&lt;&lt;i&lt;&lt;endl;
                  cout&lt;&lt;"j="&lt;&lt;j&lt;&lt;endl;
                  ptr=val;
              }
          }
      }
      void getArry(){
          for(int i=0; i&lt;MaxSize; i++){
              for(int j=0; j&lt;MaxSize; j++){
                  cout&lt;&lt;"i="&lt;&lt;i;
                  cout&lt;&lt;"j="&lt;&lt;j;
                  cout&lt;&lt;ptr[i][j];
                  cout&lt;&lt;endl;
              }
          }
      }
  };
  int main() {
      ptrArry obj1;
      obj1.setArry(50);
      obj1.getArry();
      return 0;
  }
  </code></pre>