Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete and correct C function named findch with the following properties:... a) Write a complete and correct C function named findch with the

image text in transcribed

Write a complete and correct C function named findch with the following properties:...

a) Write a complete and correct C function named findch with the following properties. 1) Accepts two parameters-a string and a single character Searches the string to see if the given character exists inside the string Returns via the return statement one of the following possible values: if character was found rightarrow location (index) of the first occurrence of the character within the string if character was not found rightarrow integer -1 (negative one) to indicate failure The function should be silent, i.e., it should not prompt for input nor should in print anything. You may assume the input string argument is terminated properly with a NUL (\ ) Suppose string is "Portland, Oregon" and character is a rightarrow returned value should be 5 Suppose string is "zebra" and character is 'f' rightarrow returned value should be -1 The following C function uses array notation. Re-write the function to replace all of the array (i.e., brackets and indices) with its pointer equivalent (i.e., *and offsets). void fun (int x[], int y[], int size) { for (int k = 0:k size-1 k++) y[k] = x[k] + x[k+1]

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

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions