Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(int ac, char **av)
- {
- printf("%c\n", **(av+2));
- if (ac != 3)
- {
- fprintf(stderr, "Usage: %s string char\n", *av);
- return (-1);
- }
- unsigned int count = 0;
- char *str = *(av+1);
- char c = **(av+2);
- while (*str)
- {
- if (*str == *c)
- count++;
- str++;
- }
- fprintf(stdout, "%u\n", count);
- return (count);
- }
Add Comment
Please, Sign In to add comment