Search
 
SCRIPT & CODE EXAMPLE
 

CPP

passing a function as an argument in c

void func ( void (*f)(int) ) {
  for ( int ctr = 0 ; ctr < 5 ; ctr++ ) {
    (*f)(ctr);
  }
}
Comment

c function as paramter

// function ask for void function with int param
void func ( void (*f)(int) );

// void function with int param :)
void print ( int x ) {
  printf("%d
", x);
}

// pass print function to func 
func( print )
Comment

passing a function as an argument in c

void func ( void (*f)(int) );
Comment

PREVIOUS NEXT
Code Example
Cpp :: matrix dynamic memory c++ 
Cpp :: how to cout in c++ 
Cpp :: list in c++ 
Cpp :: How do I read computer current time in c++ 
Cpp :: cuda shared variable 
Cpp :: check if a key is in map c++ 
Cpp :: inline c++ 
Cpp :: cpp ifdef 
Cpp :: print hello world c++ 
Cpp :: Function to calculate compound interest in C++ 
Cpp :: map in c 
Cpp :: map in cpp 
Cpp :: c++ print text 
Cpp :: c ++ split_string 
Cpp :: c++ vector first element 
Cpp :: exponent of x using c c++ 
Cpp :: add matic mainnet to metamask mobile 
Cpp :: initialising 2d vector 
Cpp :: google test assert stdout 
Cpp :: cpp oop 
Cpp :: how to declare a 2d vector stack 
Cpp :: c++ set intersection 
Cpp :: opengl draw house using glut c++ 
Cpp :: declare empty array in c++ 
Cpp :: greatest and smallest in 3 numbers cpp 
Cpp :: c++ write string 
Cpp :: stl map remove item 
Cpp :: c language all keywords in string 
Cpp :: c++ unordered_map initialize new value 
Cpp :: deque 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =