Function pointer in c programming | Callback function

preview_player
Показать описание
You are watching "Function pointer in c programming" now !

In this video, We will understand the basic concept of function pointer in c programming language , and will see its usage as callback function.

Function pointers , are like normal variable pointer , which points to the address of memory location of first instruction.

Function pointer can be declared as ,
return type , asterisk key operator , function pointer name , and arguments data types separated by comma .

It can be declared in two ways.
One by using m percent operator.
Second , without using m percent operator.
De-referencing also depends on the type of assignment done.
If the assignment has done by using m percent operator , it has to be de-reference with asterisk key operator.

And , if the assignment has done without using m percent operator , it can directly be de-reference . Just with the function pointer name.

Callbacks -
In computer programming, a callback, also known as a "call-after" function, is any executable code that is passed as an argument to other code; that other code is expected to call back the argument at a given time.

For array of function pointers, we have to mention array size , at the time of declaration.
C Programming Tutorial .

#bydubebox #programming #callbacks #pointers
Рекомендации по теме
Комментарии
Автор

At 2:05 it should be 'void (*func_ptr) (int)'.

KaleshwarVhKaleshwarVh
Автор

There is an error. The function pointer must be declared as follows:
void (*fct)(int)
And not,
void * fct(int)
In this case it is a function that returns a void* type
Friendly

josch