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 982925d

Browse files
author
mostafa
committed
array
1 parent 6102a6f commit 982925d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎array/array.go‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package main
2+
3+
import "fmt"
4+
5+
func main() {
6+
var num [3]int
7+
num[0] = 1
8+
num[1] = 2
9+
num[2] = 3
10+
fmt.Println(num)
11+
12+
a := [3]int{1, 2, 3}
13+
fmt.Println(a)
14+
15+
b := [...]int{1, 2, 3, 4, 5, 6}
16+
fmt.Println(b)
17+
18+
// array slice
19+
c := b[1:3]
20+
fmt.Println(c)
21+
// modify slice data which also change main array
22+
c[0] = 25
23+
fmt.Println(b)
24+
}

0 commit comments

Comments
(0)

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