Created
June 23, 2016 09:37
-
-
Save kssreeram/891a0399661513bb70cf17c26aa6f72a to your computer and use it in GitHub Desktop.
Guess the output...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func test1(inout v:[Int], inout _ x:Int) { | |
v[0] += 1; | |
x += 1; | |
} | |
func test2(inout v:[Int], inout _ x:Int) { | |
v[0] += 1; | |
v.append(20); | |
x += 1; | |
} | |
var a = [10]; | |
test1(&a, &a[0]); | |
var b = [10]; | |
test2(&b, &b[0]); | |
print(a[0], b[0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment