Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program 2. Write a function my_strcpy(char str1[], char str2[], int str2_size, int p1, int p2) which copies the C-string in str1 (from index p1

image text in transcribedC++ program

2. Write a function my_strcpy(char str1[], char str2[], int str2_size, int p1, int p2) which copies the C-string in str1 (from index p1 to index p2) to str2 (size is str2_size). Your function has to check if str2 has enough space. If there is no enough space in str2 to accommodate the string, print an error message but not copy anything to str2. Also write a driver program to test your function. Sample program output: str1 = I love C++ so much! str1 = I love C++ so much! Copy from str1 to str2 ... Copy from str1 to str2 ... Start position: 3 Start position: 3 End position: 13 End position: 10 >> Error str2 = love C++ >> str2 does not have enough space. Try again? (y) n >> Copy failed. Try again? (y) y Have a nice day

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

What is Centrifugation?

Answered: 1 week ago

Question

To find integral of ?a 2 - x 2

Answered: 1 week ago

Question

To find integral of e 3x sin4x

Answered: 1 week ago

Question

To find the integral of 3x/(x - 1)(x - 2)(x - 3)

Answered: 1 week ago

Question

What are Fatty acids?

Answered: 1 week ago