Question: c program Exercise 3 Exercise Objectives Manipulating strings using pointers Relationship between arrays and pointers Problem Description Write and run a C program that performs
c program
Exercise 3
Exercise Objectives
- Manipulating strings using pointers
- Relationship between arrays and pointers
Problem Description
Write and run a C program that performs the following:
- Create two arrays of charecters each of size 100
- prompts the user to enter 2 strings and store them in the two character arrays
- Passes the second string to a recursive user defined function named recusive_vowels_count that takes an input parameter of type char* (null-terminated C strings of characters). The size of the input string is not passed as parameter.The function should return number of vowels in the string.
- Print the number of vowels (from inside the main)
- Write a C function named IsPrefix that takes two input parameters SmallS and BigS of type char* (null-terminated C strings of characters) and determines if SmallS is a prefix of BigS ( ). If SmallS is a prefix of BigS, the function returns 1; otherwise, it returns 0. The sizes of the input strings are not passed as parameters. Assume that SmallS is guaranteed to be shorter than BigS. For example, if BigS is Cprogrammingisgood and SmallS is Cprog or Cpr, the function should return 1, while if SmallS is Clang or programming or good, the function should return 0.
- In the main function, pass any two string to the function IsPrefix such that the first string is smaller than the second one, and print the result return by the function
Sample run
Enter the First String (without spaces)
C_prog
Enter the Second String (without spaces)
C_programming_is_good
The number of vowels in the string C_programming_is_good is 6
The string C_prog is a prefex of the string C_programming_is_good
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
