What are the differences in len() and cap() functions of slice in go?
Answer / Priyanka Rani
The len() function returns the number of elements that a slice currently contains, while cap() returns the allocated capacity of the slice. If the capacity of a slice is not sufficient to append additional elements using the append() function, it will grow automatically when needed until its capacity matches the length.
| Is This Answer Correct ? | 0 Yes | 0 No |
What are channels in go language and how can you use them?
Who is known as the father of go programming language?
How you can write multiline strings in go?
What is type “bool” default value?
What gopath environment variable is?
What is go routine in go? How you can stop go routine?
What is go programming language? Explain
What is default value of a global variable in go?
What is default value of a global and local variable in go?
What is go (golang) programming language?
How a pointer is represented in go?
Why should one use go programming language?