Advanced C #1: Function Pointers
Вставка
- Опубліковано 28 тра 2024
- Function pointers, how are they useful and how to use them.
Stackoverflow post with shellcode example: stackoverflow.com/questions/1...
Explain weird C in English: cdecl.org
Socials:
Github: github.com/cacharle
Linkedin: / charles-cabergs
I zoom in more in later tutorials
FYI: This series of videos doesn't have any particular order to it, you don't need to watch the early videos to watch the latest ones.
its definitely not a good idea to put # after C
Indeed, tricking the C# devs into learning C, that was my master plan all along
@@cacharle evilest thing one can do to C# dev
@@cacharle genius, subscribed
@@cacharle The hero we needed
I skipped this video three times cause of this the YT algo just knows I like C so it was persistent 😂
my favorite thing about function pointers is that you can store them in a data structure and call any function with the same signature
True it's kind of like having methods in c++ except you get runtime polymorphism because you can reassign the function pointer to something else, you can obviously do the same thing in c++ if you specifically want to do that too but generally you would just use normal methods in c++
what do you call polymorphism in a functional language?
Excellent video! We definitely need more of this.
Once suggestion: the font size.
At least 2 times bigger would be more readable.
Thanks again for the video!
thank you :), I've zoomed in even more in later videos.
very useful, and good explanation! please keep it up.
Pls increase font size for ease of viewing
great video! it's so interesting that I'm finding lots of fresh videos about a language built more than 50 years ago. Is C becoming more popular, I wonder ?
I love the simplicity of C, compared to other "advanced" languages like C++, Java & Rust. C is one of those easy-to-learn but hard-to-master thingies.
thanks for sharing these little snippets of knowledge
Thanks! Unfortunately, I don't think C (or simpler languages) are going to become more popular :') But I really hope I'm wrong about that.
The only simple language that I've seen get traction is Go. I think C will stick around for a long time still so it's definitely worth learning.
@@cacharleto me, Go is just simple at the surface. If you dig just a bit under that and look at the std source code, you'll see for yourself it's not that simple at all, a lot of nasty stuff is hidden. But it's a good inspiration and a beautiful language to work with.
@@LeCockroach hmm, I've never dived in the Go stdlib source but if you have any example, I would be curious to look at them.
I was just saying that out of all the language used widely in production, Go is the only simple on I could think of beside C.
I was looking for some advance c tutorial yesterday night and here we go.
Happy to serve :)
The explaination is good. Good content.
thank you! this is a phenomenal video and i'll be watching and working alongside the others on your channel as well
Thanks, I'm glad you got something out of it 😄
nice. I enjoy your explanations.
I'm nowhere near advanced level in C..but I'm subbed now!
Awesome content Sir!
Thank you, I hope this series will make you better at C :)
Nice concept. I love it.
Thank you so much for doing this. Please continue on this series. I have subscribed and liked ur videos and I am going to watch all of them. It's hard to get an advanced c programming course anywhere else.
I'm glad you like it, I'm not sure I will continue the "Advanced C" series but I do plan on making more C related videos and streams with similar content where I dive in more obscure subjects trying to understand how stuff works under the hood.
I thought this was C# 1.0 tutorial for a second. Well played😅
Hi Charles, you can zoom-in a bit so mobile watchers can see the text being typed. And so we dont need to zoom and pan. Thank you for your understanding.
It's more zoomed-in in the next videos
thank you!
it's also used when you create a thread
Indeed
I wasn't confused, I know C is the Charlemagne of programming languages, top tier thumbnail
Finally someone that gets it, I feel less alone now 😂
@@cacharle a rare history buffs 🤝 C programmers
If C is Charlemagne then which language is Charles Martel?
@@sack-shaw Hmm, a bit less known, slightly older, I would say Fortran or Algol😄
Oh fuck the first couple of minutes i was thinking "Function pointers in C#? Damn, they change things fast!" But then i noticed "#include " and realised it's #1 is for the video number 1 XD
No no, it's actually an extremely advanced C# tutorial. In fact, I managed to make C# so much better that it actually looks like C now
@@cacharle lol
What neovim plugins are you using to get synax errors and intellisense?
I use the builtin LSP server of neovim and configure it with nvim-lspconfig: github.com/neovim/nvim-lspconfig
For auto completion, I use nvim-cmp: github.com/hrsh7th/nvim-cmp
My neovim config can be found here: github.com/cacharle/dotfiles/blob/03eb44293762bbbe7459b91a4c7bdf23e62a5bf6/config/nvim/lua/plugins.lua#L69
And cmp config: github.com/cacharle/dotfiles/blob/03eb44293762bbbe7459b91a4c7bdf23e62a5bf6/config/nvim/lua/plugins.lua#L235
great stuff! Could you do videos os efficient error handling/debbuging in C?
I can definitely do a video about error handling. As for debugging, I mostly use printf out of lazyness.. I use gdb for really hard bugs occasionaly.
A good way to "debug" is to have a assert() everywhere to check some condition that should not exist
Even if its baiting C#. The typedef function pointer is the same thing as a delegate in C# but I think the return type is the last parameter. (Also its more fucked up and confusing then reading how pointers are allocated in memory in C, imo)
I have 0 experience with C# tbh 😅 but it's nice to know that it looks like C.
and the "bait" was accidental, I already had made too many thumbnails to change it when people made me notice it 🤣
@@cacharle I'm thankful you make these videos. I was learning C and finished reading C - Programming Language 2nd Edition. When your video popped up on my feed.
I was like "What? Since when C# has function pointers? You mean delegates?"
*click*
Oh it is C
Yup, a lot of people get tricked but I'm too lazy to change every single title now 😂
thankyou
sweet
Not me looking at this for 3 minutes before understanding that I was looking at C and not C# kek
😅
Tell me , from where i can study the whole c23 programming language?
Here is the specification: en.cppreference.com/w/c/23
@@cacharle thanks
How can I learn more about pointers?
I think writing your own linked list is a good exercise to learn about pointers (or any kind of data structure that contains pointers you need to do operations with)
I used this *great* debugger pythontutor.com/c.html#mode=edit to learn more easily about pointers in school, it has a very nice way of visualizing pointers, hope this helps.
This video is a good introduction to C pointers 'C: malloc and functions returning pointers': ua-cam.com/video/3JX6TyLOmGQ/v-deo.html
It's at almost at Charles level regarding teaching :o), but it's strait forward way of explaining about C pointers have have helped many viewers.
Must be bigger.
yo moma big enough tho
🤣🤣 I swear it was c#
yup, a lot of people do 😅