Tutorial: Passing a Function, Function callback
Introduction
Find derivative of given function
void gradientFunc(double myfunc(const double x), double x[ ], double dydx[ ], int m);Calling a function within another function
Method 1
#include "stdio.h"
#include "stdlib.h"
#include "TU_functionCall_header.h"
// These are defined in TU_functionCall_header.h
// double myFunc(const double x);
// void func_call(double xin);
// How to change the function equation in myFunc()
// if myFunc() is defined in library header file?
//
// Q2) What if myFunc2() is needed to be used?
// What do you need to modify in TU_functionCall_header.h ?
void main()
{
double xin = 2.5;
func_call(xin);
}Method 2 (recommended)
Last updated