Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- typedef void (*FUNCTION_INT_INPUT_1_RETURN_VOID)(int);
- typedef void (*FUNCTION_INT_INPUT_2_RETURN_VOID)(int, int);
- void sample_1(int input_a);
- void sample_2(int input_y, int input_z);
- FUNCTION_INT_INPUT_1_RETURN_VOID main_function (FUNCTION_INT_INPUT_2_RETURN_VOID temp_2);
- // start main function
- void main(void) {
- printf("trace 3\n\n");
- (main_function(&sample_2))(10);
- printf("trace 4\n\n");
- }
- void sample_1(int input_a) {
- int *temp_a;
- temp_a = (int *)malloc(sizeof(input_a)*1);
- *temp_a = input_a-5;
- printf("result sample_1 is %i\n\n",*temp_a);
- free(temp_a);
- }
- void sample_2(int input_y, int input_z) {
- int *temp_b;
- temp_b = (int *)malloc(sizeof(input_y)*2);
- *temp_b = input_y + input_z;
- printf("result sample_2 is %i\n\n",*temp_b);
- free(temp_b);
- }
- FUNCTION_INT_INPUT_1_RETURN_VOID main_function (FUNCTION_INT_INPUT_2_RETURN_VOID temp_2) {
- if (temp_2) {
- temp_2(3,4);
- }
- printf("trace 1\n\n");
- return &sample_1;
- }
Add Comment
Please, Sign In to add comment