Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int count(char *input)
- {
- int counter = 0;
- int i;
- // Durchlaufe bis zur Null-Terminierung
- // (Wird von scanf drangehängt)
- for (i = 0; input[i] != '\0'; ++i)
- ++counter;
- return counter;
- }
- int main()
- {
- // Maximal 19 (-1 wegen null Terminierung) erlaubt
- char input[20];
- // Lese Benutzereingabe
- scanf("%19s", input);
- // Gebe Anzahl aus
- printf("%d", count(input));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement