Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help! Write a C function int atby(char t[]. char s[) that takes a string of length less than 100 (but not known) in array

Please help! Write a C function int atby(char t[]. char s[) that takes a string of length less than 100 (but not known) in array s, and replaces each instance of the word \"at\" with the word \"by\". Your function should not modify the original string in array s, but make a new copy in the array t supplied by the calling program. Your function should return the number of times the word \"at\" was found in the original string. You may not use any of the string functions (str...). 2. (20 pts) The function int findchar(char c, char s[) searches a string in arrays for the first instance of the character in c. The function returns the index (location) of c in s[] if it finds it, and -1 otherwise. Write a main program to test findchar. Your program should include the test strings, and not read them from a file or the terminal. Your program should print out the results of the testing. Do not write the function itself 3. (20 pts) Find and correct three errors in the following function: (extra }'s are not errors) #include find the fourth letter in a string of at least 4 letters. Then modify the string by changing every instance of that letter to the letter A. Return the number of times that letter was found. \"/ int fun4(char s char c; int count-0 inti c s[4]; for(i-0; s[i]!=\"10\" if (sli]c){ s[i]= A';} } return count; 4. (20 pts) The following program reads in the name of a city and prints it out. Modify it to read in the name of a city and state, separated by a space, and print them out. If it reads Tulsa Oklahoma, it should print: The city is Tulsa, the state is Oklahoma. int getword(char w, int l); #include main) (int len; char city[100]; len getword(word, 100); printf(\"The City is %s\", city); return 0; #include int getword(char word], int limit) int n; char c; for(n-0; (c getchar0)! - EOF) & &(c!=' )&& (n)>

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

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions