当前位置:网站首页>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
边栏推荐
猜你喜欢
Open source rule engine - Ice: dedicated to solving flexible and complex hard coding problems
Graphics.FromImage报错“Graphics object cannot be created from an image that has an indexed pixel ...”
Laravel implements the Holy Grail model with template inheritance
开源规则引擎——ice:致力于解决灵活繁复的硬编码问题
Anti crawler (0): are you still climbing naked with selenium? You're being watched! Crack webdriver anti crawler
弘玑|数字化时代下,HR如何进行自我变革和组织变革?
如果我是pm之 演出电影vr购票展示
What role do tools play in digital transformation?
Camera imaging + homography transformation + camera calibration + stereo correction
Three 之 three.js (webgl)旋转属性函数的简单整理,以及基于此实现绕轴旋转的简单案例
随机推荐
d. TS --- for more detailed knowledge, please refer to the introduction on the official website (chapter of declaration document)
MFC implementation resources are implemented separately by DLL
创建进程内存管理copy_mm - 进程与线程(九)
Anti crawler (0): are you still climbing naked with selenium? You're being watched! Crack webdriver anti crawler
Qingdao agile tour, coming!
Why can't V-IF and V-for be used together
Good test data management, in the end how to do?
To understand Devops, you must read these ten books!
2021-10-08
[untitled] Notepad content writing area
Output string in reverse order
Ehcache Memcache redis three caches
Master-slave replication of MariaDB database
弘玑Cyclone RPA为国金证券提供技术支撑,超200个业务场景实现流程自动化
If I am PM's performance, movie VR ticket purchase display
Three of three JS (WEB GL) model deletion / scene emptying / simple sorting of memory release
相机成像+单应性变换+相机标定+立体校正
Three 之 three.js (webgl)旋转属性函数的简单整理,以及基于此实现绕轴旋转的简单案例
egg测试的知识大全--mock、superTest、coffee
Call the interface to get the time