Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- programmatically mocking a function
- #include <stdio.h>
- void someFunc( void )
- {
- printf("%s():%dn",__func__,__LINE__);
- }
- void someBlah( void )
- {
- printf("%s():%dn",__func__,__LINE__);
- }
- int main(void)
- {
- someFunc();
- }
- #define BLAH 0
- #define FOO 1
- void (*table_function[])(void) = {someBlah, someFoo};
- table_function[BLAH]();
- table_function[BLAH] = otherBlah;
- #include <stdio.h>
- #define DEBUG
- void someFunc( void )
- {
- #ifndef DEBUG
- printf("%s():%dn",__func__,__LINE__);
- #else
- printf("%s():%dn",__func__,__LINE__);
- #endif
- }
- int main(void)
- {
- someFunc();
- }
Add Comment
Please, Sign In to add comment