-
-
Save Maksim-Zhuravlev/47e5965611598d87c44774826b4533fd to your computer and use it in GitHub Desktop.
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
#include <stdlib.h> | |
#include <stdio.h> | |
int firstMethod(int x) { | |
return x; | |
} | |
void main() { | |
struct Method { | |
char *description; | |
int (*doAction)(int); | |
}; | |
const struct Method methods[] = { | |
{.description = "Descr 1", .doAction = firstMethod}, | |
{.description = "Descr 2", .doAction = firstMethod}, | |
}; | |
const size_t methodsCount = sizeof(methods) / sizeof(struct Method); | |
for (int i = 0; i < methodsCount; i++) { | |
printf("%d. %s\n", i + 1, methods[i].description); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment