Тёмный

Zig Master: Let's Create a Stack! 

Dude the Builder
Подписаться 3,6 тыс.
Просмотров 1,4 тыс.
50% 1

Help me create more content like this!
www.paypal.com...
With all the knowledge we've acquired so far, we can build our very own data structure in Zig. In this episode, we'll build a stack that can handle growth via heap allocation and as a bonus we even make it generic. NOTE: I had a little off-by-one bug in the code shown in the video where I compared the slice length plus one as greater than or equal to, when it should be just greater than (in the push method). I made the fix and the code in the repo is now correct.
The code: codeberg.org/d...
Relevant Links:
ziglang.org/do...
Thumbnail artwork courtesy of: www.deviantart...

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 9   
@EliasDorneles
@EliasDorneles 2 месяца назад
This is great stuff, man! This example is exactly what I needed: it answers several questions I had and gives a great example of generic data structure! Thank you so much for this!
@thilina91
@thilina91 15 дней назад
thanks for the great video on creating generic data types. cheers!
@raptorate2872
@raptorate2872 3 месяца назад
Hello Dude thanks for all your help, you are a lifesaver for those who want to learn zig. May i ask how to navigate through the 2 different playlists you have. It would seem like they have overlapping concepts.
@dudethebuilder
@dudethebuilder 3 месяца назад
Thanks for the support. I would recommend watching the videos in Zig in Depth first, specifically those that pertain to the language and not the build system or project tools. Then you can catch up with recent changes with the videos in Zig Master.
@juanpablouriolbalbin887
@juanpablouriolbalbin887 2 месяца назад
I think you are allocating new memory even though you still have space for one more element. In your example, you double the capacity from 8 to 16 when you add the 7th element (index 6). Therefore, you still have space for an 8th element.
@dudethebuilder
@dudethebuilder 2 месяца назад
Correct! I noticed that just as I finished recording the video and added a note to the description. The actual code on the repo has been fixed. Thanks for the heads-up.
Далее
Zig Master: Let's Create a Trie!
17:14
Просмотров 2,1 тыс.
File Systems - IO from Scratch - Part 10
32:20
Просмотров 9 тыс.
10 weird algorithms
9:06
Просмотров 1,2 млн
C++ Game Programmer Tries ZIG for the first time.
5:28
Zig Master: Introduction to Allocators
34:19
Просмотров 2,1 тыс.
Andrew Kelley   Practical Data Oriented Design (DoD)
46:40
Let's Create a Compiler (Pt.1)
1:11:03
Просмотров 531 тыс.
Zig Master: Memory in Practice
20:45
Просмотров 1,1 тыс.
Zig Master: Slices
25:25
Просмотров 936