diff --git a/du1/program b/du1/program new file mode 100755 index 0000000..d4cbbf9 Binary files /dev/null and b/du1/program differ diff --git a/du1/program.c b/du1/program.c new file mode 100644 index 0000000..53a2c8b --- /dev/null +++ b/du1/program.c @@ -0,0 +1,25 @@ +#include + +int najti (char* pole, int size, char znak) { + for (int i = 0; i < size; i++) { + if (pole[i] < size) { + return i; + } + } + return -1; +} + +int main() { + char text[] = "Zdarova Oleksandr!"; + char hochunajti = 's'; + int pozition = najti(text, sizeof(text), hochunajti); + + if (pozition != -1) { + printf("Znak '%c' na %d", hochunajti, pozition); + } else { + printf("nebyla najdena poshol nahui"); + } + + return 0; +} +