subroutine_direct.c and subroutine_indirect.c

Created Diff never expires
3 removals
23 lines
3 additions
23 lines
#include <stdio.h>
#include <stdio.h>


typedef int (*func_t)(void);
typedef int (*func_t)(void);


int subroutine(){
int subroutine(){
printf(" I am the subroutine\n");
printf(" I am the subroutine\n");
return 0;
return 0;
}
}


int main(int argc, char *argv[])
int main(int argc, char *argv[])
{
{
printf("--> Start %s\n", argv[0]);
printf("--> Start %s\n", argv[0]);


// Direct call
// Direct call
subroutine();
//subroutine();


// Indirect call
// Indirect call
//func_t f_sub = &subroutine;
func_t f_sub = &subroutine;
//f_sub();
f_sub();


return 0;
return 0;
}
}