This code takes 3 parameters as input.
Input : InitialValue, Row, Col
Output : 2D array
Ex: Input 1, 3, 3
Output :
1 2 3
4 5 6
7 8 9
Where am i going wrong here ? Is there any better way to modify whatever i've written
#include<bits/stdc++.h>
using namespace std;
int** func(int s,int r,int c);
int main()
{
 int s,row,col;
 cin >> s >> row>> col;
 int** res;
 res = func(s,row,col);
for(int i=0;i<row;i++)
{
 for(int j=0;j<col;j++)
  {
  cout << res[i][j]<<" ";
  }
 cout << endl;
}
 return 0;
}
int** func(int s,int r,int c)
 {
  int** arr;
  for(int i=0;i<r;i++)
  {
   for(int j=0;j<c;j++)
   {
     arr[i][j]=s;
     s = s+1;
    }
  }
   return arr;
 }
 
     
    