Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please help me answer this question using POINTERS Thanks!! Question 9: (30 points) Implement the function to take in a 10-character string 'string'1'

Can you please help me answer this question using POINTERS
Thanks!! image text in transcribed
Question 9: (30 points) Implement the function to take in a 10-character string 'string'1' and 3-character pattern string 'pattern' from the user- Search for the 'pattern' in 'stringl' and display "pattern found" if 'pattern' is found in stringl'. For instance, if user enters string1= "abcdefghij" and pattern- "ghi", then the pattern exists in stringi, so display "pattern found". Do not display anyhting if pattern is not found in stringl You MUST use pointers and not arrays for this question. You may use string functions You may not add more variables than already declared. You may use 'int i' for 'for' loop, if needed. Note :When using fgets0), when you press Enter to finish entering the string, the Enter (In) character is also added to the string. So a 10-character string actually looks like "abcdefghijlnle". So consider storing 12 elements for 10-character string. void searchPattern() char *string1, pattern; int string!Len-0, patternLen = 0; // while(getchar() !. .); // Enter your code here // use this line to get rid of In left behind by scanf and similar functions in code above Output nter the 10-character string which needs to be searched for a pattern: quizmaster ter the 3 character pattern to search: ast

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions