Your question isn’t clear, but I think you might want something like this:
int foo(int i){ return i + 1;}
typedef int (*g)(int); // Declare typedef
g func = &foo; // Define function-pointer variable, and initialise
int hvar = func(3); // Call function through pointer
Related Contents:
- Understanding typedefs for function pointers in C
- How do function pointers in C work?
- typedef struct vs struct definitions [duplicate]
- Why should we typedef a struct so often in C?
- uint8_t vs unsigned char
- typedef fixed length array
- How can I use an array of function pointers?
- C isn’t that hard: void ( *( *f[] ) () ) ()
- self referential struct definition?
- How does the C code that prints from 1 to 1000 without loops or conditional statements work?
- Convert objective-c typedef to its string equivalent
- Are typedef and #define the same in c?
- Casting a function pointer to another type
- What’s the purpose of this [1] at the end of struct declaration?
- Returning function pointer type
- dereferencing pointer to incomplete type
- Does Function pointer make the program slow?
- C : typedef struct name {…}; VS typedef struct{…} name;
- What’s the syntax for declaring an array of function pointers without using a separate typedef?
- How to get function’s name from function’s pointer in Linux kernel?
- How do I use typedef and typedef enum in C?
- What does ((void (*)())buf)(); mean?
- Opaque C structs: various ways to declare them
- What is the use of typedef?
- Function pointers and address of a function
- What is ‘forward declaration’ and the difference between ‘typedef struct X’ and ‘struct X’?
- Determining to which function a pointer is pointing in C?
- How to format a function pointer?
- How can I call a function using a function pointer?
- Why does having an `int (*)(float)` point to an `int foo()` trigger a warning, but having an `int (*)(double)` point to it doesn’t?
- Function pointer as an argument
- How to define a typedef struct containing pointers to itself?
- How do you read C declarations?
- Enforce strong type checking in C (type strictness for typedefs)
- How to implement a “private/restricted” function in C?
- Printing all global variables/local variables?
- How are multi-dimensional arrays formatted in memory?
- Difference between *ptr += 1 and *ptr++ in C
- Math constant PI value in C
- Why GDB jumps unpredictably between lines and prints variables as “”?
- What is the difference between stdin and STDIN_FILENO?
- How do you declare a recursive mutex with POSIX threads?
- Why exactly do we need a “Circular Linked List” (singly or doubly) data structure?
- What is the difference between ssize_t and ptrdiff_t?
- Should I set errno?
- Getting started with autotools
- C: How to free nodes in the linked list?
- A Simple, 2d cross-platform graphics library for c or c++? [closed]
- struct serialization in C and transfer over MPI
- aligned malloc() in GCC?