Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ab65ae4

Browse files
pass by value
1 parent 7502827 commit ab65ae4

File tree

1 file changed

+23
-0
lines changed
  • Learn_CPP_Programming_Deep_Dive/Section 10 Functions/Pass_by_value

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <iostream>
2+
3+
4+
using namespace std;
5+
6+
void swap(int a, int b)
7+
{
8+
int temp = a;
9+
a = b;
10+
b = temp;
11+
}
12+
13+
14+
15+
int main(void)
16+
{
17+
int x = 1978, y = 1977;
18+
swap(x,y);
19+
20+
cout<<x<<" "<<y;
21+
22+
return 0;
23+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /