How to create an empty array of strings with a fixed size in Go

1 Answer

0 votes
package main

import "fmt"

func main() {
    // Create an empty array of strings with a fixed size
    var arr [5]string // Array of size 5
    fmt.Println("Array:", arr)

    // Get the size of the array
    size := len(arr)
    fmt.Println("Size of the array:", size)
}



/*
run:

Array: [    ]
Size of the array: 5

*/

 



answered Jul 22, 2025 by avibootz
...