Hey Guys! I was just trying out a simple problem to do it in another way. The problem is to convert 2-D array into 1-D array. I know it's very easy but it can be done in many ways and I want to do it in my way.
So I wrote this piece of code but it is giving me errors . Please see it!
#include<iostream>using namespace std;int r, c;const int * d;void convert(int a, int e, int b[][d]){for(int i = 0; i < d; i++){cout << b[0][i] << " ";}}int main(){cout << "Enter number of rows and columns : " << endl;cin >> r >> c;int a[r][c];for(int i = 0; i < r; i++){for(int j = 0; j < c; j++){cin >> a[i][j];}}d = new int [r*c];convert(r, c, a);return 0;}