当前位置:网站首页>Similarities and differences between vector and array (notes)
Similarities and differences between vector and array (notes)
2022-04-23 05:27:00 【What’smean】
identical :
An array with the vector The similarity is that they can store objects of the same type , And these objects themselves have no names , Need to access... From its location .
Different :
An array with the vector The biggest difference is , The size of the array is fixed , You can't add additional elements to the array at will , Although runtime performance is better in some situations , But with the vector Compared with the loss of flexibility .
say concretely , The dimension of the array has been determined at the time of definition , If we want to change the length of the array , You can only create a larger new array , Then copy all the elements of the original array to the new array . We can't be like vector Use like that size Function to directly obtain the dimension of the array . If it's a character array , You can call strlen Function to get the length of the string ; If it's another array , Only use sizeof(array) /sizeof(array [0]) Calculate the dimension of the array .
版权声明
本文为[What’smean]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220544124292.html
边栏推荐
- SQL Server检索SQL和用户信息的需求
- My old programmer's perception of the dangers and opportunities of the times?
- Semi synchronous replication of MariaDB
- Self incrementing sequence creation of MySQL
- 分支与循环语句
- 2021-09-28
- Watch depth monitoring mode
- Study notes: unity customsrp-13-colorgrading
- phphphphphphphp
- Intel SGX preliminary learning and understanding notes (continuously updated)
猜你喜欢

Open source rule engine - Ice: dedicated to solving flexible and complex hard coding problems

分支与循环语句

selenium预先加载cookie的必要性

My old programmer's perception of the dangers and opportunities of the times?

JS array common methods

When is it appropriate for automated testing? (bottom)

2021-11-08

Source code analysis of how to use jump table in redis

Intel SGX preliminary learning and understanding notes (continuously updated)

Graphics.FromImage报错“Graphics object cannot be created from an image that has an indexed pixel ...”
随机推荐
Basic knowledge of redis
Low code and no code considerations
Implementation of resnet-34 CNN with kears
Quick app bottom navigation bar
Laravel routing settings
如果我是pm之 演出电影vr购票展示
Three 之 three.js (webgl)简单实现根据点绘制线/弧线(基于LineGeometry / Line2 / LineMaterial,绘制两点基于圆心的弧线段)
Devops life cycle, all you want to know is here!
Cloud computing and cloud native architecture design of openshift
Blender programmed terrain production
Box collapse and margin collapse
Multi process model in egg -- egg document Porter
C test calls the paddlesharp module to recognize pictures and words
d.ts---更详细的知识还是需要看官网的介绍(声明文件章节)
CORS and proxy (づ  ̄ 3  ̄) in egg ~ the process of stepping on the pit and filling the pit ~ tot~
Domain driven model DDD (III) -- using saga to manage transactions
Study notes: unity customsrp-10-point and spot shadows
2021-09-28
The source of anxiety of graduating college students looking for technology development jobs
C# ,类库