What are function pointers in C?

preview_player
Показать описание
In JS it is very easy to pass functions around, but in C... it is possible but not to the same degree. Let's take a look!
Рекомендации по теме
Комментарии
Автор

Simple, straight and functional. Perfect.

fernandoalbuquerque
Автор

this channel is gonne get me through my exams, thank you so much.

bicenman
Автор

I don't know if you read comments anymore, but i have to say, really good job. very simple and concise. for those of us that sometimes can't focus or need a break from needing a break from reading such videos are a blessing. thanks for uploading

hellNo
Автор

ohh memories from my lovely old C.... Thanks for sharing.

juanmamani
Автор

Thanks for this video. Surprised to see that a feature like this exists in C -- I'm used to it as a pseudo-functional thing in higher languages like C#.

jackkendall
Автор

Thank you dude, you are very well-spoken.

commissarsydian
Автор

Thank you very much, you really helped me. Great job! :)

mirus
Автор

Could you give an example of the practical use case?
That would make things really clear.
Thanks in advance 😊

Vineeth_Shankar
Автор

hi, this was a very good tutorial, thank you sir.

galshaviner
Автор

Awesome video! I just have one question though. I have a stack data structure that is used to create an undo() functionality by trying to store the exact opposite of the operation that was last performed and then calling it. I am trying to use function pointers for that, but the problem is that there many functions with different signatures and varying amounts of parameters and types involved. How can I store them all under one Node struct and then evaluate which specific type to call later on?

default
Автор

One thing, I believe you could have mentioned is that you don't NEED to give the address of the function 'mul/add' to the function pointer 'fun' since the function name itself is the address of the function.
i.e. you can just write 'fun = mul;' and it'll work fine.
Good tutorial otherwise, thanks :)

aviralsharma
Автор

it is an adres so why it puts out value?

bartlomiejodachowski
Автор

void *(*f)(void *) difference void (*f)(void *) ?

Nathan-vtzw