In program language C: The problem is to write a program that counts the number of letters, digits, other characters, and total characters from the input. If the user does not provide any additional command-line arguments, count the occurrences from standard input. If there is an additional command-line argument, count the occurrences in the string provided on the command line.
In
It must use two functions: one that calculates the counts from standard input, and another that calculates the counts from a string (in this case you'll want to pass argv[1] to the latter function, if argv[1] exists). In main(), check the number of command line arguments to see which function to call, call the appropriate function to get the counts, and then print out the counts in main(). Each function should require you to return multiple values.
The program must use two of the following strategies, one for each of the function implementations:
Step by step
Solved in 2 steps