#include <cstdlib>
#include <iostream>

using namespace std;

void fun(int *arr, int rows, int cols);

int main(int argc, char *argv[])
{
    int arr[4][6];
    int x=0;
    for(int i=0; i<4; i++)
    {
            for(int j=0; j<6; j++)
            {
                    arr[i][j] = x;
                    x++;
            }
    }
   
    fun(&arr[0][0], 4, 6);
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

void fun(int *arr, int rows, int cols)
{
	
    for(int i=0; i<rows; i++)
    {
            for(int j=0; j<cols; j++)
            {
                    cout << *(arr+i*rows+j) << " ";
            }
            cout << endl;
    }
    
    cout << endl << endl;
}
