How is len() different from cap() function?
Answer / Arun Pratap Saroj
len() returns the length of a slice or string, while cap() returns the allocated capacity (maximum length) of a slice. For example, if you have a slice with length 5 and capacity 10, len() would return 5 and cap() would return 10.
| Is This Answer Correct ? | 0 Yes | 0 No |
How can you check a variable type at runtime in go programming language?
Why golang is fast?
Does go programming language support type inheritance?
What is go programming language? Explain
Why does my go process use a lot of virtual memory?
What are channels and how can you use them in golang?
What is type casting in golang?
Is it true that short variable declaration := can be used only inside a function?
How pointer is represented in go?
Is “maps” value types?
How would you print type of variable in go?
How can an entry be deleted from a map?