#include int occurrences(char *, char); int main(int argc, char **argv) { char c; int check; if (argc == 1) printf("Should be at least one command line argument supplied after the file name\n"); else { printf("Enter a character to search the string\n"); c = getchar(); printf("Number of occurrences of %c within the string is %d\n", c, occurrences(*(argv + 1), c)); } return 0; } int occurrences(char *inputString, char c) { int i = 0; int r = 0; while (*(inputString + i) != '\0') { if(*(inputString + i) == c) r++; i++; } return r; }