We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41329f5 commit 7d89e15Copy full SHA for 7d89e15
ADT/miscellaneous/misc++/2darray.cpp
@@ -0,0 +1,36 @@
1
+/********************
2
+ * An Implementation of 2d Array using double pointer
3
+ *
4
5
6
7
8
+ * ************************/
9
+#include<iostream>
10
+
11
+using namespace std;
12
13
+int main() {
14
+ int **arr2d;
15
+ int r = 3, c = 5;
16
17
+ arr2d = new int*[r];
18
19
+ for(int i=0; i<r; i++)
20
+ {
21
+ int *tempPtr = new int[c];
22
+ cout<<"\nEnter "<<c<<" numbers:-\n";
23
+ for(int j=0; j<c; j++)
24
+ cin>>*(tempPtr + j);
25
26
+ *(arr2d + i) = tempPtr;
27
+ }
28
29
+ cout<<"\nContents of "<<r<<'x'<<c<<" 2d array are:-\n";
30
+ for(int i=0; i<r; i++) {
31
32
+ cout<<*(*(arr2d+i) + j)<<" ";
33
+ cout<<"\n";
34
35
+ return 0;
36
+}
0 commit comments