摘要:        
数组与切片 的 Q&A 切片作为函数参数 type slice struct { array unsafe.Pointer len int cap int } slice其实是一个结构体,包含三个成员,len、map、array,分别表示长度、容量和底层数组的地址 当slice作为函数参数时,就是一    阅读全文
posted @ 2022-03-14 14:48
专职
阅读(84)
评论(0)
推荐(0)
        
            
        
        
摘要:        
案例1: func main() { slice := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} s1 := slice[2:5] // s1=[2, 3, 4], len=3, cap=8 s2 := s1[2:6:7] // s2=[4, 5, 6, 7], len    阅读全文
posted @ 2022-03-14 14:09
专职
阅读(371)
评论(0)
推荐(0)
        
 
                    
                     
                    
                 
                    
                
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号