Question: C Program This is a C program using Strings, arrays(Only declare, MUST USE PURE POINTER NOTATION TO FILL ALL ARRAYS) and functions. 1 . Code
C Program
This is a C program using Strings, arrays(Only declare, MUST USE PURE POINTER NOTATION TO FILL ALL ARRAYS) and functions.
1. Code a function to generate a string (s1) which contains a random pattern of UPPER case letters 'A' - 'Z' (Length of string should always be 41 characters including a '\0' (null) character to end the string).
2. Code a function to allow the user to enter a string (s2 - minimum length 2 characters, max 20, must be validated to be smaller than s1 or return an error message) containing a random pattern of UPPER case letters A-Z and then a replacement character , c.
3. Code a user defined function, (strfilter(s1,s2,c)) that searches s1 and replaces any occurance of any of the characters contained in s2 with the character in c.
4. Output the generated string, the user entered string and the filtered string from the main program.
5. After output allow the user to enter another string if they chose and repeat the process (s1 should only be randomy generated once regardless of repeat or not. s2 and c are user generated for each repeat).
Exampe of output after user input:
s1 = {'FJKLSIOEFNAALKJVOIUPAWENFKLAALKYUFGIOEAPVNOA"}
s2 = {"AL"}
c = {"*"}
filtered s1 = {"FJK*SIOEFN***KJVOIUP*WENFK****KYUFGIOE*PVNO*"}
Things to Note:
1. After completion allow the user to enter yes or no (Y/N) to repeat the above process.
2. to generate the random Pattern for S1 use the function RAND. S1 should be generated only once regardless of if the user wants to repeat or not. if user repeats then the next session uses the same s1 as the last session.
3. String must terminate with '\0' (maximum for s1 includes this null character)
4. MUST use pure pointer notation to fill arrays.
5. Arrays can only be declared, everything else is done through pure pointer notation.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
