-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#include "structs_with_pointers.h" | ||
|
||
int process_struct_with_func_pointer(struct MainStruct* str) { | ||
if (str && str->inner && str->inner->func_id != 0) { | ||
return 1; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef UNITTESTBOT_STRUCTS_WITH_POINTERS_H | ||
#define UNITTESTBOT_STRUCTS_WITH_POINTERS_H | ||
|
||
typedef int (*some_func)(); | ||
|
||
struct InnerStruct { | ||
some_func func; | ||
int func_id; | ||
}; | ||
|
||
struct MainStruct { | ||
struct InnerStruct* inner; | ||
}; | ||
|
||
int process_struct_with_func_pointer(struct MainStruct* str); | ||
|
||
#endif // UNITTESTBOT_STRUCTS_WITH_POINTERS_H |