C++ Function Pointers 1: Introduction

preview_player
Показать описание
Today we'll look at the basics of a very interesting mechanism: Function Pointers!

They're very useful for callbacks and event driven programming. Today we'll only cover the basics, a description of what they are, their syntax and how to use them.

This topic is a confusing one, but I don't think it needs to be. The trick is knowing what machine code is, and how it is represented in the computer. Machine code is just an array of bytes in RAM, exactly the same as data. A function pointer is a variable that holds the address of a function so we can jump the CPU there and execute the function indirectly.

The most difficult thing about function pointers is their strange syntax in C++.

I've tried to explain things from a slightly different angle. If you've had trouble understanding what function actually are, then I hope this vid helps.

FaceBook:
Рекомендации по теме
Комментарии
Автор

Please continue your series, you're awesome!

Bauibaubau
Автор

Thanks for the great tutorial. When you will do the next?

cesarpeixoto
Автор

Great job mate! Really good tute. +1 for the humour too:)

donramanayake
Автор

thank you. I like when you try to read your randomly typed gibberish variables :) Any chance for a part 2 ?

romanemul
Автор

Creel did u ever make a second video on function pointers ?

rajcodes
Автор

can u please explain event driven cal back functions.

sammydeew
Автор

looked for SCOMP everywhere, couldn't find it -_-

bruninhalol
Автор

it's note eaven c++ it's just c functionnality.but think's any way ii's very useful when you want to make a win32 wrapper. (a subset of win32)

rachidsatsalut
Автор

Please note some advantages of PCIe SSD's - in an programmed RAID 0 arrays they are comparable to RAM, but with quite larger size features. RAM even an quad-channel are not so fast in real-world practical applications - please bench your device.

piotrlenarczyk
Автор

the addresses of my functions return "1" for some reason..

vertigo