To convert the array to slice at anytime we can use simply :(dot notation) shown in below
Source Code:
package main import ( "fmt" "reflect" ) func main() { arr := [4]string{"go", "lang", "main", "sree"} fmt.Println("Arr is of type...", reflect.TypeOf(arr)) arr2 := arr[:] //Converts arr of type array to slice arr2 fmt.Println("Arr2 is of type..", reflect.TypeOf(arr2)) }
Output:
Arr is of type... [4]string
Arr2 is of type.. []string
Please comment or write us if you have any queries/requirements.
Please like,follow,bookmark,subscribe this site to receive daily updates.
LinkedIn Group - Srinivas4sfdc (I Love Coding... You?)
FaceBook Page - I Love Coding. You?
Hope this helps you..Enjoy..!
B6BFF9B5
ReplyDeletependik olgun esçort
yenişehir esçort
serik esçort
akyurt esçort
gölcük esçort
kilyos esçort
cide esçort
kilis esçort
seferihisar esçort
76297134
ReplyDeleteErzurum Esçort
Uşak Esçort
Erzincan Esçort
Zonguldak Esçort
Antep Esçort
Manisa Esçort
Kastamonu Esçort
Osmaniye Esçort
Karaman Esçort