Quick actions

cmd+k|ctrl+k

Navigation

Languages

function pointer stuff

Snippet info

Language

C

Visibility

public

Author

evine

Created

2016-01-13T15:49:39Z

Updated

2016-01-14T20:56:38Z

#include <stdio.h>

void ffff(int ee)
{
    printf("apple: %i\n",ee);
}

typedef struct
{
    int ppp;
    void (*eee)(int);
}qqq;



int main() {
    
    qqq eple;
    
    eple.ppp = 9;
    eple.eee = &ffff;
    
    (*eple.eee)(eple.ppp);
    
    
    void (*tt)(int);     // Return type, *name , arguments.
    tt = &ffff;         // "Address off" is optinal. (implicitly casted)
    (*tt)(5);           // Dereference pointer is optinal. Look below.
    
    (&ffff)(7);         // Address to a fuction is vaild.
    (&printf)("valid function call\n");
    
    return 0;
}
INFO