Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Cap() Function in Golang is used to get the v’s capacity. To access this function, one needs to imports the reflect package in the program.
Syntax:func (v Value) Cap() int
Parameters: This function does not accept any parameters.
Return Value: This function returns the interger value.
Below examples illustrate the use of the above method in Golang:
true 1 1
Type : [chan] Capacity : 
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.