No video

Dynamic Arrays of Objects (Data Structures course, step-by-step)

  Рет қаралды 18,859

CodeBeauty

CodeBeauty

Күн бұрын

Пікірлер: 90
@CodeBeauty
@CodeBeauty Жыл бұрын
📚 Learn programming with these Free E-Books ⬇ C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook 🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/ Experience the power of practical learning, gain career-ready skills, and start building real applications! This is a step-by-step course designed to take you from beginner to expert in no time! 💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10). Use it quickly, because it will be available for a limited time. **CODE FROM THE VIDEO** #include using namespace std; class Student { public: string Name; int Age; char Gender; float ProgrammingGrade; }; void printStudents(Student* students, int size) { for (int i = 0; i < size; i++) { cout
@awaism.a5192
@awaism.a5192 9 ай бұрын
Absolutely superb ❤ but i need to know about female and boys array how to do that could just show me declaring it how to declare it i dont get any idea to do it
@heikin5562
@heikin5562 5 ай бұрын
Thank you so much for this free lesson. I can finally finish my project about array insertion and deletion, with the knowledge i gained here
@CodeBeauty
@CodeBeauty 4 ай бұрын
Glad it was helpful!
@omercandemirci6410
@omercandemirci6410 Жыл бұрын
Thanks saldina for your helps. As an turkish electrical engineer student which want to learn Computer science, it is Hard to me learn something due to my language. Your language and explanation so clear that I can comprehend all what you want to teach in video. You are not just programmer teacher for me but also english teacher. ❤
@CodeBeauty
@CodeBeauty Жыл бұрын
You're very welcome! I'm genuinely glad to hear that my explanations are helping you grasp the concepts. I'm here to support your learning journey in both computer science and English. Your dedication and enthusiasm are truly commendable. Keep up the great work, and don't hesitate to reach out if you have more questions or need further assistance. Happy learning! 🌟
@aaronsj80
@aaronsj80 Жыл бұрын
I like that you covered how the string is a pointer and also that you talked about the size of the student class. I noticed on the spreadsheet your addresses for each element were consecutive bytes, so it's good that you clarified it when getting to the copy code.
@CodeBeauty
@CodeBeauty Жыл бұрын
I realized that using Excel would help students visualize what I'm explaining, and I'm glad that it was helpful. :D
@tumwesigyeisaac5073
@tumwesigyeisaac5073 10 ай бұрын
hi Saldina, am an electrical engineering student at Kabale university in Uganda. i love the way you deliver programming content, you really made me fall in love with programing though am pursuing electrical engineering
@handover007
@handover007 3 ай бұрын
I want to see more videos like this. Thanks Saldina.
@CodeBeauty
@CodeBeauty 3 ай бұрын
You're welcome 😊 🥰
@htvital4184
@htvital4184 Жыл бұрын
Thanks from bottom of my heart
@874D8
@874D8 4 ай бұрын
the explanation about memcpy , deep and shallow copy was 🔥
@carmelostagno6352
@carmelostagno6352 Жыл бұрын
if the course you are preparing will be like these videos, then I can't wait. Thanks Saldina!
@CodeBeauty
@CodeBeauty Жыл бұрын
It will be better! I put so much work and effort into the course. I'm sad that I can not finish it faster, but quality requires time, and this has to be the best programming course ever. Coding will become your native language after this course. Whatever you can think of, you can create with your own hands and a keyboard! ❤️
@uzumakiibram1762
@uzumakiibram1762 Жыл бұрын
Thanks mommy, i have learned a lot ❤
@milkamilkica1935
@milkamilkica1935 Жыл бұрын
the best teacher ever!
@CodeBeauty
@CodeBeauty Жыл бұрын
thank you :D
@eliasrodriues6614
@eliasrodriues6614 Жыл бұрын
You are a good teacher.
@CodeBeauty
@CodeBeauty Жыл бұрын
thank you :D
@rezafarokh8637
@rezafarokh8637 Жыл бұрын
34:43 Practical task for you (with instructions) Student* getInput(Student* students, int start, int end) { for (int i = start;i < end; i++) { cout > students[i].Age >> students[i].Gender >> students[i].ProgrammingGrade; cout
@TrueNRG
@TrueNRG Жыл бұрын
Симпотная барышня😊
@CodeBeauty
@CodeBeauty Жыл бұрын
Спасибо :D
@codeoasis1180
@codeoasis1180 Жыл бұрын
great explanation
@CodeBeauty
@CodeBeauty Жыл бұрын
Glad it was helpful!
@kamyarbasiri959
@kamyarbasiri959 Жыл бұрын
I'm looking forward watching the video
@CodeBeauty
@CodeBeauty Жыл бұрын
let me know if you find it helpful :D
@user-xm7ir9gv1u
@user-xm7ir9gv1u Жыл бұрын
Thanks a lot! I have learned much C++ skills from you, I love you CodeBeauty!
@CodeBeauty
@CodeBeauty Жыл бұрын
Happy to hear that!
@vetledeilkas538
@vetledeilkas538 Жыл бұрын
When the program exits, all memory (both on the stack and on the heap) is deallocated automatically. So to delete the memory right before the program exits makes no difference, although it is good practice! Also, with the practice example, there's no need to return a pointer to the array of students, as you pass the pointer to the students array as an argument to the function. Returning void is sufficient. The same array will be modified in the function as the memory of the array is passed to the function. Please correct me if I said something wrong! Overall very good video!
@CodeBeauty
@CodeBeauty Жыл бұрын
In C++, memory management is more manual. You need to allocate and deallocate memory yourself. In some other languages like C# for example, memory management is more automated, especially for objects on the heap, thanks to the garbage collector, which automatically frees memory when objects are no longer needed. Stack memory in C# is managed similarly to C++, where it's automatically deallocated when the variable's scope ends. :D
@CodeBeauty
@CodeBeauty Жыл бұрын
One thing that you can do is use smart pointers. They are a container/wrapper for a raw pointer. In modern C++ smart pointers are defined in the std namespace in the memory header file. One big advantage of smart pointers is that they are responsible for deleting the memory that they use, which means that they automatically deallocate the memory when they go out of scope. :D You can check out my video about smart pointers if you want to learn more about this, here: kzfaq.info/get/bejne/m5h8gKSY1Ne9j58.html
@zoldyck3526
@zoldyck3526 Жыл бұрын
Thanks a lot you are a good teacher.
@CodeBeauty
@CodeBeauty Жыл бұрын
always good to hear :)
@nicholaskomsa1777
@nicholaskomsa1777 3 ай бұрын
there is some std STL object, std::array, which would be used in place of a depreciated sort of c-array
@shreyashpawar1689
@shreyashpawar1689 Жыл бұрын
Love from India ❤🇮🇳
@CodeBeauty
@CodeBeauty Жыл бұрын
Love for India! ❤
@user-lu6kv9kr8u
@user-lu6kv9kr8u Жыл бұрын
great value, thank you Saldina
@CodeBeauty
@CodeBeauty Жыл бұрын
Glad you think so!
@lickguitars1276
@lickguitars1276 11 ай бұрын
Thank you for this concise tutorial on dynamic arrays! It made the concept much clearer for me, and im sure it will benefit others too
@user-sw8bq1rk9c
@user-sw8bq1rk9c Жыл бұрын
great job, thank you Saldina, this is very helpful
@CodeBeauty
@CodeBeauty Жыл бұрын
I'm so glad to hear that.
@Tableskater
@Tableskater Жыл бұрын
You are so awesome ❤❤❤😊😊
@MikeysLab
@MikeysLab 7 ай бұрын
What is the efficency difference between changing student name to a fixed primitive (char Name[32]) and using memcpy, over doing a deep copy. The deep copy seems extremely inefficent especially in an embedded environment.
@_-deep_a_b.862
@_-deep_a_b.862 9 ай бұрын
thanks!
@deanmorrison6254
@deanmorrison6254 Жыл бұрын
very helpful, thank you so much
@CodeBeauty
@CodeBeauty Жыл бұрын
You're so welcome!
@valjo02
@valjo02 Жыл бұрын
Would you provide pastebin of above code or we should put an efford and try rewrite in our IDE Saldina?
@CodeBeauty
@CodeBeauty Жыл бұрын
Hey, I pinned the code in the first comment. :D
@valjo02
@valjo02 Жыл бұрын
Wow !I found it.Thanks a lot .Finally uderstand the main point of the code is to showcase how to dynamically allocate memory for an array of objects, resize the array based on user input, and copy the existing objects to the new array while adding new objects if required. 👍👌💜@@CodeBeauty
@amelccc
@amelccc Жыл бұрын
great job as always 👌👌
@CodeBeauty
@CodeBeauty Жыл бұрын
Thank you so much 😀
@AbderrahmenBenabbas
@AbderrahmenBenabbas Жыл бұрын
Could you give me the names of C++ Books that you have read
@CodeBeauty
@CodeBeauty Жыл бұрын
check out these 2, they are free, and they are very good (one of them is for C++) bit.ly/freeCppE-Book bit.ly/FreeObjectPascalEbook
@christopherrice891
@christopherrice891 Жыл бұрын
Saldina have you ever made a 3-D open world video game in C++? I'm asking because making games is why i want to learn C++ so badly.
@CodeBeauty
@CodeBeauty Жыл бұрын
I did my fair share of coding in gaming world as well and for sure I can see certain appeal in it. What are you mostly interested in?
@christopherrice891
@christopherrice891 Жыл бұрын
@@CodeBeauty i am mostly interested in games like on Playstation 5 or Game Cube or X-BOX. I watch the beginning stages of making a game on KZfaq, but i never once saw a video game built from the ground up. I want to see a full game created.
@muhmedgamal5841
@muhmedgamal5841 2 ай бұрын
goooooooooooooood
@anwar6971
@anwar6971 Жыл бұрын
Thanks
@CodeBeauty
@CodeBeauty Жыл бұрын
Welcome :)
@lpmc1182
@lpmc1182 Жыл бұрын
do you have any suggestion of projects that are job-ready and worth to be added on a cv in order to apply for jobs? I'm struggling in finding project ideas and can't come up with any on my own, and "to do list" type of projects I assume they aren't job ready
@CodeBeauty
@CodeBeauty Жыл бұрын
Well, depending on your current skill set there are many suitable ideas. But since you are on channel that is mainly focused on C++ and C# so far and given the fact that you are looking for a job, I will assume that you don't have that much experience yet so here are some of the projects that should not be too complex to develop but still very useful as showcase of your capabilities as well as good practicing materials: Simple Console Calculator: Create a console application that performs basic arithmetic operations like addition, subtraction, multiplication, and division based on user input. Guess the Number Game: Develop a game where the computer generates a random number, and the player has to guess it within a certain number of tries. Library Management System: Design a program that allows users to manage a library's inventory, including adding, searching, and borrowing books. Student Grade Tracker: Build an application to store and calculate student grades. Allow users to input and retrieve student data and calculate averages. Personal Expense Tracker: Develop a program that helps users track their daily expenses and presents them in a clear and organized manner. Address Book: Build an application that allows users to store and manage contacts' information, including names, phone numbers, and addresses. Also, be sure to sign up here bit.ly/SimplifyingCoding and I will let you know when my practical programming course is out, with a nice discount attached. It will serve you greatly in your search for a job. Hope you will find these useful. Good luck with finding the right job for you! :)
@carlosalbertoavilapalacios5623
@carlosalbertoavilapalacios5623 Жыл бұрын
Hi Saldina. Thanks for this video. Do you know of any extension for plotting data in Visual Studio 2022, for example, plotting a data array of velocity versus time? Excuse me for the question that is off-topic from the video. Thanks for your time. Best regards
@CodeBeauty
@CodeBeauty Жыл бұрын
I think that Microsoft Chart Controls could be of help to you. I'm sure you can find plenty of resources online regarding this topic. Hope that helps. Cheers.
@jaykay6249
@jaykay6249 Жыл бұрын
Really helpful thanksksks
@jaykay6249
@jaykay6249 Жыл бұрын
You could maybe also provide the code you wrote so we could poke around a bit.
@xamgodoix
@xamgodoix Жыл бұрын
Hi! I think there is something "wrong" with the example: Student *students = new Students[3]; The expression above already allocate space for 3 students. There is no need to create another Student inside for loop. Inside for loop could be something like this: Student &s = students[i]; A reference to each student already allocated.
@CodeBeauty
@CodeBeauty Жыл бұрын
There are two options for adding data: you can create a new variable, allow the user to input data into it, and then insert this variable into the array. Alternatively, you can directly input the data into the array. It's a good exercise if someone wants to try and practice on his own. :D
@branriv8417
@branriv8417 Жыл бұрын
Hi Saldina. What program do you use to allow your viewers to see you and your screen simultaneously?
@CodeBeauty
@CodeBeauty Жыл бұрын
I'm filming me with the camera, separately from screen, which is recorded with OBS studio, then in editing I'm combining it into one video. Hope that helps.
@branriv8417
@branriv8417 Жыл бұрын
@@CodeBeauty Thank you.
@nicholaskomsa1777
@nicholaskomsa1777 3 ай бұрын
dynamic array is literally std::vector with fewer features, depreciated
@nicholaskomsa1777
@nicholaskomsa1777 3 ай бұрын
actually, calling delete on a c style array is Undefined Behavior, not a memory leak.
@deveshbhati8852
@deveshbhati8852 Жыл бұрын
Can we ?
@CodeBeauty
@CodeBeauty Жыл бұрын
check your previous comment :)
@ross350tube
@ross350tube Жыл бұрын
or... You just use vectors, which have built functions that automatically manage much of this.
@dattrax
@dattrax Жыл бұрын
I believe there was a technical error in this video. The reason for the delete is not correct, as without the [] it doesn’t run the destructors. This is where leaks occur, when the object contains another object, it wouldn’t get free’d. I also don’t believe it’s good practice to use naked new anymore but stl::vector would have been better in this instance.
@CodeBeauty
@CodeBeauty Жыл бұрын
One thing that you can do is use smart pointers. They are a container/wrapper for a raw pointer. In modern C++ smart pointers are defined in the std namespace in the memory header file. One big advantage of smart pointers is that they are responsible for deleting the memory that they use, which means that they automatically deallocate the memory when they go out of scope. :D You can check out my video about smart pointers if you want to learn more about this, here: kzfaq.info/get/bejne/m5h8gKSY1Ne9j58.html And regarding memory leaks, try this tool. I believe it should be free to download it via this link and it is static code analyzer, so you run the analysis of your code and it wil tell you if there are memory leaks and even suggest how to fix them: bit.ly/PVS-StudioFreeCB1 Hope this helps :D
@deveshbhati8852
@deveshbhati8852 Жыл бұрын
I am looking for connect with you
@CodeBeauty
@CodeBeauty Жыл бұрын
here you can find links to my social media: linktr.ee/codebeautyprogramming?fbclid=PAAabr49GuzhYS4Jfh0vw7nyDk_-uqYqKhkauLq6cqyCQSGZUH5_dVDH6-41A Cheers. :)
@deveshbhati8852
@deveshbhati8852 Жыл бұрын
Can you please reply over Instagram ?
@AlexFranck-sx7tc
@AlexFranck-sx7tc Жыл бұрын
21:13 that's not an advantage. you can very much define the size of a "static" array at runtime. The term "static array" is common but I do not understand its meaning. I would simpy call it arrays stored on the stack or stack arrays. so-called dynamic arrays are simply arrays created in the heap memory. I would call them heap arrays. the size of an array cannot be changed. I believe what you are trying to say is: data stored in a heap array can always be relocated to accommodate new data. the size of an array does not change. rather the data can be moved to a larger or smaller array, or simply to another array.
@CodeBeauty
@CodeBeauty Жыл бұрын
If you have static array you cannot reallocate it to add more elements. The size that you define while you are writing the code is the size that array will have forever, and if your collection grows and you need to add more elements than the size of the array, you won't be able to store them. Also if you create very big static array, but big chunk of that memory is empty cuz you don't have elements to put into it, than you are simply wasting memory and memory management is not efficient. Because of that you can use dynamic arrays which can be deallocate and then you can allocate new (bigger, or smaller) space for them. That way your memory management is more efficient. :D
@AlexFranck-sx7tc
@AlexFranck-sx7tc Жыл бұрын
@@CodeBeauty you do not reallocate the array. you relocate the data. once you create an array, its size is final. it does not matter if you create it on the heap or on the stack. dynamic array is more like an umbrella term. when you get more data, you create a new heap array, you move the data to that new array, and release the memory areas occupied by the old array. the size of an array does not change. it never changes.
@robertbruce7686
@robertbruce7686 Жыл бұрын
Too many ju.....mp cuts
@CodeBeauty
@CodeBeauty Жыл бұрын
you are missing the point of the video :D
@aapck
@aapck 11 ай бұрын
In C++, the 'new' and 'delete' operators can be overridden, allowing us to execute our own code when allocating or deallocating memory. This is useful in situations where memory management is expected from you, such as in embedded systems where there is no operating system. In such cases, these operators are overridden.:o)
@YMX_750
@YMX_750 7 ай бұрын
void studentinfoin(Students* students,int start,int size){ for(int i=start;i
艾莎撒娇得到王子的原谅#艾莎
00:24
在逃的公主
Рет қаралды 53 МЛН
а ты любишь париться?
00:41
KATYA KLON LIFE
Рет қаралды 3,5 МЛН
Joker can't swim!#joker #shorts
00:46
Untitled Joker
Рет қаралды 40 МЛН
7 Days Stranded In A Cave
17:59
MrBeast
Рет қаралды 93 МЛН
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,5 МЛН
Why Function Pointers are Awesome
11:11
Jacob Beningo
Рет қаралды 6 М.
NVIDIA Needs to STOP - RTX 3050 & Misleading Branding
11:35
Linus Tech Tips
Рет қаралды 1,4 МЛН
It's time for change, it's time for Linux.
10:53
DankPods
Рет қаралды 383 М.
Plexamp is a FREE ALTERNATIVE to Roon
16:07
Darko Audio
Рет қаралды 3,5 М.
艾莎撒娇得到王子的原谅#艾莎
00:24
在逃的公主
Рет қаралды 53 МЛН