Linked Lists in C

  Рет қаралды 3,222

Eric O Meehan

Eric O Meehan

Күн бұрын

This video compares C vs C++ through a concrete example - a linked list.
The linked list is a fundamental concept in computer science and serves as the basis for many data structures such as stacks, queues, and more. Having already implemented a linked list in my C++ library, I decided to recreate the same library in C to illustrate the differences between the two languages.
This video is part the hdelibc project - an open source library for C programming that provides modular components for many software development needs. It takes a somewhat object oriented perspective on the C programming language, using structs and function pointers to recreate some of the functionality from C++. The code for this library can be found on GitHub:
github.com/Hom...

Пікірлер: 17
@eyzee00
@eyzee00 Ай бұрын
Great and very informative video, C in OOP style is not something I'm used to witness! One quick note, it'd be better if a deconstructor function was added to make the program more memory efficient, we typically would call it after we are done with our list or if an error occured and we are forced to exit, so that all allocated heap blocks are freed before exit.
@andresvallelisboa5511
@andresvallelisboa5511 Жыл бұрын
24:00 you could use macros to create a generic linked list and reuse it every time you need it for different kind of data structures.
@nimcompoo
@nimcompoo 3 жыл бұрын
U r underrated bro. Your videos are really good 😀
@eom-dev
@eom-dev 3 жыл бұрын
Thank you! I appreciate it!
@EngMazen
@EngMazen 3 жыл бұрын
Hi Eric, You are doing great job I have been coding in c for long time, and learned a lot from this video, thank you very much I have some notes could improve your design 1 - Node is coupled with Linked list I would suggest putting theme in one file, also node does not have any implementation. 2 - All functions inside the LinkedList.c could be marked as static, then you do not need to put "int" in their names in addition to making sure these function are private to the file. 3 - The stranded library include header could be placed inside the .c file since no need to put it their. 4 - Placing the "struct LinkedList * linked_list" parameter fist, will mock the c++ "this" . Also, it is more common to be first.
@MrSomethingdark
@MrSomethingdark Ай бұрын
Really omplex, wrote all the code you did, can't compile it. It's over my head and now I don't know how to debug it. constructor reference undefined. Great!
@cwijit4253
@cwijit4253 2 жыл бұрын
Please do more videos creating complicated things c++.
@ankitrathore3946
@ankitrathore3946 3 жыл бұрын
Did a great job . great quality content 👍
@eom-dev
@eom-dev 3 жыл бұрын
Thank you! I appreciate it!
@hasanalattar9561
@hasanalattar9561 3 жыл бұрын
@17:38 im c user and i don't feel anything weird or special .. I've seen the object oriented being used in c as well. Great video by the way. Subscribed
@hasanalattar9561
@hasanalattar9561 3 жыл бұрын
@23:00 shouldn't you directly modify the members of node address instead of creating object in stack and then copying it to the heap?
@hasanalattar9561
@hasanalattar9561 3 жыл бұрын
Im not sure about this but since there are no template .. you will need to create c file foreach datatype for example node_float ... I might play a bit with #define and define type name there .. and somehow rename functions and datas to that .. then everytime i need to create a new template instance i would copy that c file rename it .. change the define macro as well
@eom-dev
@eom-dev 3 жыл бұрын
Thank you! I appreciate it!
@eom-dev
@eom-dev 3 жыл бұрын
This I actually solved by using void pointers and passing in raw binary data! One node can hold any data type.
@eom-dev
@eom-dev 3 жыл бұрын
That would definitely be more efficient, but I would need to take more time to revisit my work to see why I did it this way (if there is a reason at all haha).
@MrSomethingdark
@MrSomethingdark 2 ай бұрын
using the laptop mic especially with this ASMR sound is killing me. Please, just plug in some headphones and set the input to that mic and the hand it around your neck or something come on bruh. You're not typing. You are stabbing tha keyboard!
Understanding Ownership in Rust
25:30
Let's Get Rusty
Рет қаралды 280 М.
CppCon 2014: Mike Acton "Data-Oriented Design and C++"
1:27:46
I'VE MADE A CUTE FLYING LOLLIPOP FOR MY KID #SHORTS
0:48
A Plus School
Рет қаралды 20 МЛН
КОНЦЕРТЫ:  2 сезон | 1 выпуск | Камызяки
46:36
ТНТ Смотри еще!
Рет қаралды 3,7 МЛН
Templates in C++
17:58
The Cherno
Рет қаралды 612 М.
Reinforcement Learning Course - Full Machine Learning Tutorial
3:55:27
freeCodeCamp.org
Рет қаралды 1 МЛН
The Joy of Coding Winter 2025, Session 7
1:39:31
David Whitlock
Рет қаралды 82
Intro to Java Programming - Course for Absolute Beginners
3:48:25
freeCodeCamp.org
Рет қаралды 3,7 МЛН
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 857 М.
"Simple Made Easy" - Rich Hickey (2011)
1:01:39
Strange Loop Conference
Рет қаралды 110 М.
Designing a Command Line Interface and Using Embedded Libraries
1:58:08
Eric O Meehan
Рет қаралды 3,1 М.
Don't constexpr All the Things - David Sankel [CppNow 2021]
1:00:47
Better Java Streams with Gatherers - JEP Cafe #23
1:13:32