-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_to_fun2.cpp
More file actions
49 lines (42 loc) · 806 Bytes
/
Copy patharray_to_fun2.cpp
File metadata and controls
49 lines (42 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
using namespace std;
void printArray(int arr[], int n)
{
for (int i = 0; i < n; i++)
{
cout << arr[i] << " ";
}
cout << endl;
}
void increment(int a, int arr[], int n, int i)
{
a++;
arr[i]++;
}
void reversearr(int arr[], int n)
{
int i = 0;
int j = n - 1;
while (i < j)
{
// reversing the array:
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
// increment i and decrement j:
i++;
j--;
}
}
int main()
{
cout << "ARRAY TO FUNCTION OPERATIONS" << endl;
int i, a = 3;
// cin >> i;
int arr[10] = {1, 2, 3};
// increment(a,arr,10,i);
// cout<<"a : "<<a<<endl;
// cout<<"arr[i]: "<<arr[i]<<endl;
reversearr(arr, 3);
printArray(arr, 3);
}