Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computing 1 C programming C source file, Assgn6.c, on Blackboard: http: //uml.umassonline.net Description: Create a project called Assgn6. Add a C source file to the

Computing 1
C programming image text in transcribed
C source file, Assgn6.c, on Blackboard: http: //uml.umassonline.net Description: Create a project called Assgn6. Add a C source file to the project named assign6.c. A string is nothing but a list of characters. The first character of a string can be pointed by a pointer, say sp, and the 2^nd character of the string can be accessed by *(sp + 1), for example. Also, it may be useful to use a function that returns the number of characters in a string: int strlen (char *string); Write a function int find string char *source, char substring) that searches for the first occurrence of substring in source and returns the index of the first character of substring where it is found in the source. If substring does not occur in source, a value of -1 is returned. For example, if original = "software catalog" and portion = "cat", find string(original, portion) will return 9, since the c of "cat" occurs starting at 9^th position of "software catalog" when the first character s is counted at the 0^th position. The main() function asks for the source string and the substring to search for in the source string, calls the find string() function, and prints the index value returned from the find string() function

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_2

Step: 3

blur-text-image_3

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

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions