diff --git a/main.c b/main.c new file mode 100644 index 0000000000000000000000000000000000000000..14f6cd74aefc8de857ee57b7a5b7c486acd79901 --- /dev/null +++ b/main.c @@ -0,0 +1,70 @@ +#include <stdio.h> + +#include <stdio.h> +#include <stdlib.h> +#include <stdbool.h> + + +int HowToStrLength(char *wert); +int areThere2Names(char *wert); + +int main() + { + char* wert = ""; + HowToStrLength(wert); + + + printf("der ausgegebene Name lautet: %s\n", wert); + + printf("the length of our string is %d\n", HowToStrLength(wert)); + areThere2Names(wert); + return 0; + +} + + + +int HowToStrLength(char* str) + { + int count = 0; + while (*str != '\0') + { + str++; + count++; + } + if (count ==0) + + return printf("Fehlerfall: leerer Parameter"); + + +} + + + +int areThere2Names(char* str) +{ + int index = 0; + int count = 0; + while (str[index] != '\0') + { + if (str[index] == ' ') + { + count ++; + + + } + index++; + } + + printf("the count of our spaces = %d\n", count); + + if (count == 0) + { + return printf("Fehlerfall, nicht mindestens zwei Namensteile im Parameter"); + } + +} + + + +