Convert Int data type to Int16 Int32 Int64
Example
package main
import (
"fmt"
"reflect"
)
func main() {
var i int = 10
fmt.Println(reflect.TypeOf(i))
i16 := int16(i)
fmt.Println(reflect.TypeOf(i16))
i32 := int32(i)
fmt.Println(reflect.TypeOf(i32))
i64 := int64(i)
fmt.Println(reflect.TypeOf(i64))
}
Output
int
int16
int32
int64
Most Helpful This Week
Struct Instantiation Using Pointer Address Operator
Concurrency in Golang
Go program to find PTR pointer record of a domain
Golang program to generate number of slices permutations of number entered by user
How do you handle HTTP server HTTP/2 in Go?
How to convert Struct fields into Map String?
Program in Go language to print Pascal's Triangle
How to add items to Slice using append function in Golang?
Find Type of Struct in Go Programming Language
What is an HTTP client in Go?