Question
Download the file patternMatch.c from Canvas. This file contains part of a program to do pattern matching. The function main looks like this: The function
Download the file patternMatch.c from Canvas. This file contains part of a program to do pattern matching. The function main looks like this:
The function readline should read a line of characters from the keyboard. The second argument to the function is the maximum number of characters to read. If a line has more characters than that, the function should ignore the rest of the characters on the line. The function returns the number of characters read. Note that the array should not contain the ' ' from the end of the line, nor should it include a terminator character such as '
adminuser@adminuser-VirtualBox~/Desktop $./a.out Enter text: abcdefg Enter pattern: ?bc? The pattern was found at char 1. The remaining text chars are: efg adminuser@adminuser-VirtualBox -/Desktop $/a.out Enter text: abcdefg Enter pattern: b?c no match adminuser@adminuser-VirtualBox /Desktop $-a Enter text: abcdefg Enter pattern: b??e?g The pattern was found at char 2. The remaining text chars are: adminuser@adminuser-VirtualBox -/Desktop $ adminuser@adminuser-VirtualBox~/Desktop $./a.out Enter text: abcdefg Enter pattern: ?bc? The pattern was found at char 1. The remaining text chars are: efg adminuser@adminuser-VirtualBox -/Desktop $/a.out Enter text: abcdefg Enter pattern: b?c no match adminuser@adminuser-VirtualBox /Desktop $-a Enter text: abcdefg Enter pattern: b??e?g The pattern was found at char 2. The remaining text chars are: adminuser@adminuser-VirtualBox -/Desktop $Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started