I have the following pieces of code:
struct DataBase {
union manip_types *manip;
};
union manip_types{
void ( *man_insert )( struct DataBase *, struct auto_increment *, enum db_insert_types,... );
void ( *man_remove )( struct DataBase *, struct auto_increment *, enum db_remove_types, int );
void ( *man_update )( struct DataBase *, enum db_update_types, int,... );
union db_query_union ( *man_query )( struct DataBase *, enum db_query_types, int );
struct db_query_extended ( *man_query_ex )( struct DataBase *, struct auto_increment *, enum db_query_types,... )
};
And then i did:
db->manip = malloc( 5 * sizeof( union manip_types ) );
db->manip[ 0 ].man_insert = &db_insert;
db->manip[ 1 ].man_remove = &db_remove;
db->manip[ 2 ].man_update = &db_update;
db->manip[ 3 ].man_query = &db_query;
db->manip[ 4 ].man_query_ex = &db_query_ex;
The code above generates the following warning for each [ 0, 1, -> 4 ]
Assignment from incompatible pointer type.
Function prototypes:
void db_insert( struct DataBase *db, struct auto_increment *a_i, enum db_insert_types db_insert_type,... )
void db_remove( struct DataBase *db, struct auto_increment *a_i, enum db_remove_types db_remove_type, int removeId )
void db_update( struct DataBase *db, enum db_update_types db_update_type, int upId,... )
union db_query_union db_query( struct DataBase *db, enum db_query_types db_query_type, int queryId )
struct db_query_extended db_query_ex( struct DataBase *db, struct auto_increment *a_i, enum db_query_types db_query_type,... )
What should i modify? And how could i call that array of pointers ? For example, v[ 4 ].