Answers for "function inside struct c"

C
0

function inside struct c

typedef struct client_t client_t, *pno;
struct client_t
{
        pid_t pid;
        char password[TAM_MAX]; // -> 50 chars
        pno next;

        pno (*AddClient)(client_t *);  <-- pointer to function    
};

pno client_t_AddClient(client_t *self) { /* code */ } <-- function

int main()
{

    client_t client;
    client.AddClient = client_t_AddClient; // probably really done in some init fn

    //code ..

    client.AddClient(&client);

}
Posted by: Guest on May-05-2021

Code answers related to "C"

Browse Popular Code Answers by Language