Skip to content

Commit 6eb95b3

Browse files
committedJun 17, 2024
Creating a dynamic array, taking input & showing output of it
1 parent 08493bc commit 6eb95b3

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed
 

‎input.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
5
21
10 20 30 40 50

‎return_array_function.cpp

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int *fun()
5+
{
6+
int *a = new int[5];
7+
for (int i = 0; i < 5; i++)
8+
{
9+
cin >> a[i];
10+
}
11+
return a;
12+
}
13+
14+
int main()
15+
{
16+
int *p = fun();
17+
for (int i = 0; i < 5; i++)
18+
{
19+
cout << p[i] << " ";
20+
}
21+
22+
return 0;
23+
}

‎return_array_function.exe

49.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)