Learn C++ With Me #18 - Vectors

preview_player
Показать описание
Welcome back to another C++ tutorial! In this video, we're going over vectors. Vectors are resizeable arrays that are able to change their size based off of what is inside them.

⭐️ Timestamps ⭐️
00:00 | Introduction
00:37 | What Are Vectors?
01:54 | Creating Vectors
02:24 | Access Vector Elements
03:12 | Common Vector Methods and Capacity
08:21 | Insert and Erase Elements
10:49 | Iterating Through Vectors

◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
💰 Courses & Merch 💰

🔗 Social Medias 🔗

🎬 My YouTube Gear 🎬

💸 Donations 💸
◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️

⭐️ Tags ⭐️
- C++ Tutorial
- C++
- Coding Tutorial
- Tech With Tim
- Vectors

⭐️ Hashtags ⭐️
#TechWithTim #C++Programming
Рекомендации по теме
Комментарии
Автор

Thank you so much, Tim! This C++ study is the best series from this channel, at least for me. Also more basics of ... could I say, a computer science, would be awesome.

lukaslescinskas
Автор

Could you please continue this series. Your way of teaching is truly amazing

shamaeelahmed
Автор

man i was so stuck in a homework and you made me see the light, thank you so much

minemoi
Автор

bro waiting for 21 C++ tutorial ...bring it alive man...you are my hope :)

abrarmasumabir
Автор

3rd method to iterate throught vector:

for (auto num : v1)
cout << num << endl;

MrMShady
Автор

Hi Tim! Thank you for the vids! I'm a student and its so hard to learn at home but you're making it better for us. Thank you! :D

stopbysometimes
Автор

Vectors are important. I brushed passed it in CS 2 cause i was so focussed on pointers and still am cause pointers are a beast lol. However, its something I'm taking more time in and learning because the fact is when you do a lot of these hackerank assessments or leetcode problems. Vectors are what you need to know to solve the problems. I was so confused when first trying some problems because I had the right mindset but an array wont cut it. Its as you said, regular arrays are good for when you know what you need. it has to have a static and constant size. Which is good in theory for a lot of problems but the problem is there a lot it isnt good enough as well

souljarohill
Автор

Thank you so much tim for this tutorial. I was just thinking about learning vectors and this video pops up. Could really use this in memory hacking.

gilberthangshing
Автор

A different method to insert:
int main()
{
std::vector<int> v1 = { 1, 2, 3, 4 };
std::vector<int>::iterator it = v1.begin();
std::advance(it, 2);
v1.insert(it, 5);
std::cout << v1[2];

return 0;
}

Output:
5

jibinvarghese
Автор

I thought you only make python tutorials, but now this!!

ritchielrez
Автор

We can insert a value in a vector directly by knowing its index. Like for a vector v1 -> v1[0] = 2;

divijagarwal
Автор

Good summary, short and sweet. Thanks.

torishi
Автор

Hey Tim, your videos have been a great help! Thank you. I seen that during the vid you were looking at your notes to ensure which functions to utilize for the code. Would you mind sharing the source of the information you use for your code and your c++ tutorials in general?

dususbakahyahskahwbwm
Автор

You are awesome Tim but could you do an algorithms C++ series after this.

emodat
Автор

you can also iterate through a vector using, for example:
for(int i : [vector name]) {}

this will iterate through the vector, and will automatically assign i the value at the place in the vector

hitthatrwnoflare
Автор

You could use short hand for loop to iterate over collections

ketansonar
Автор

Very useful thank you very much you explained it really well

theblock
Автор

you can offset the v1.begin() +( actual place you want insert ) like this :v1.insert(v1.begin()+5, 1111));

mikmik
Автор

So here you discuss about the one dimensional array of vectors right? But I wonder if there're any two dimensional vector arrays.

manipurihunabopa
Автор

10:11

maybe v1.insert(*(v1), 5);

since the pointer of the *array* starts at the first element address

xx_xxx_xxx_xx