Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please make the code in c language 1. (60 pts) Write a function which can add any character to a specified index of a string.

image text in transcribed

please make the code in c language

1. (60 pts) Write a function which can add any character to a specified index of a string. Function prototype must be as follows: void insertchar (char string[], char c, int index) string parameter: String which the function will add a character. c parameter: The character to be added to string. index parameter: The index which the function will insert the character. Notes: 1. insertChar function should not overwrite any characters. It should insert the new character and offset remaining characters by one index. 2. You can try your function with a complete code which gets a string, a character and an index from the user and show the result. But, only insertChar function is necessary and will be graded. 3. Only methods and functions we learned during the course should be used. Otherwise, it will not be graded. Example parameter sets with corresponding outputs: string index Result: Hello world ! 11 Hello world! Let's eat mom! 9 Let's eat, mom! I have to now k 10 I have to know I like cooking cats and dogs 14 I like cooking, cats and dogs c Supplementary information (Not necessarily related with the homework): Question: How can I get rid of the new line character ( ) while using fgets function? Answer: You can replace new line character with null character (*\0'). See the example below. #include #include int main(void) char st(100); fgets (st, 100, stdin); st(strlen(st) - 1] = '\0'; printf("%s", st); return 0

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

Objects And Databases International Symposium Sophia Antipolis France June 13 2000 Revised Papers Lncs 1944

Authors: Klaus R. Dittrich ,Giovanna Guerrini ,Isabella Merlo ,Marta Oliva ,M. Elena Rodriguez

2001st Edition

3540416641, 978-3540416647

More Books

Students also viewed these Databases questions

Question

Define the geoid and ellipsoid.

Answered: 1 week ago

Question

Strong written and verbal communication skills

Answered: 1 week ago

Question

Explain the key areas in which service employees need training.

Answered: 1 week ago

Question

Understand the role of internal marketing and communications.

Answered: 1 week ago