GoLang
xxxxxxxxxx
package main
import "fmt"
func main() {
s := make([]string, 3)
fmt.Println("emp:", s)
s[0] = "a"
s[1] = "b"
s[2] = "c"
fmt.Println("set:", s)
fmt.Println("get:", s[2])
fmt.Println("len:", len(s))
s = append(s, "d")
s = append(s, "e", "f")
fmt.Println("apd:", s)
c := make([]string, len(s))
copy(c, s)
fmt.Println("cpy:", c)
l := s[2:5]
fmt.Println("sl1:", l)
l = s[:5]
fmt.Println("sl2:", l)
l = s[2:]
fmt.Println("sl3:", l)
t := []string{"g", "h", "i"}
fmt.Println("dcl:", t)
twoD := make([][]int, 3)
for i := 0; i < 3; i++ {
innerLen := i + 1
twoD[i] = make([]int, innerLen)
for j := 0; j < innerLen; j++ {
twoD[i][j] = i + j
}
}
fmt.Println("2d: ", twoD)
}
emp: [ ] set: [a b c] get: c len: 3 apd: [a b c d e f] cpy: [a b c d e f] sl1: [c d e] sl2: [a b c d e] sl3: [c d e f] dcl: [g h i] 2d: [[0] [1 2] [2 3 4]]
Linux - Comment installer anc-api-tools
Linux - Comment installer curvedns
Python - Vérifier si un nombre est positif, négatif ou 0
Linux - Comment installer zenmap
C - Compter le nombre de chiffres dans un entier
C++ - Vérifier l'année bissextile
JavaScript - Vérifier si une chaîne commence et se termine par certains caractères
C++ - Vérifier si un nombre est premier ou non
C - Trouver le plus grand nombre à l'aide de l'allocation de mémoire dynamique
Kotlin - Arrondir un nombre à n décimales
Kotlin - Inverser un nombre
Linux - Comment installer xbitmaps
Linux - Comment installer zstd
Kotlin - Trouver la factorielle d'un nombre
Linux - Comment installer zfs-test
C++ - Convertir un nombre binaire en décimal et vice-versa
Java - Inverser un nombre
Kotlin - Calculer la somme des nombres naturels
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month