Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Github: https://github.com/nezvers
- Youtube: https://www.youtube.com/channel/UCb4-Y0E6mmwjtawcitIAzKQ
- Twitter: https://twitter.com/NeZversStudio
- */
- #include <iostream>
- using namespace std;
- typedef struct encode_char {
- const char* text;
- }encode_char;
- typedef struct encode_stats {
- const char* name;
- int age;
- }encode_stats;
- void hello(void *arg){
- encode_char *my_decoder;
- my_decoder = (encode_char*)arg;
- cout << "Hello " << my_decoder->text << "!" << endl;
- }
- void stats(void *arg){
- encode_stats *my_decoder;
- my_decoder = (encode_stats*)arg;
- cout << "Name: " << my_decoder->name << endl;
- cout << "Age: " << my_decoder->age << endl;
- }
- int main()
- {
- void (*function_pointer1)(void*);
- function_pointer1 = hello;
- encode_char char_encoder = {"world"};
- //function_pointer1( (void *) &char_encoder );
- void (*function_pointer2)(void*);
- function_pointer2 = stats;
- encode_stats stats_encoder = {"NeZvers", 32};
- //function_pointer2( (void *) &stats_encoder );
- void (*function_trigger)(void*);
- function_trigger = function_pointer1;
- function_trigger( (void *) &char_encoder );
- function_trigger = function_pointer2;
- function_trigger( (void *) &stats_encoder );
- return 0;
- }
Add Comment
Please, Sign In to add comment