Question: Write a function copystr(char *p1, char *p2, int m) that takes two strings and one integer as arguments. It will copy from the mth character

Write a function copystr(char *p1, char *p2, int m) that takes two strings and one integer as arguments. It will copy from the mth character of p1 to its end to p2. The main function is provided. It will ask the user to input one string and the number of the character that copystr start coping.

Below is the example run

Input string: reading-room

Which character that begin to copy? 9

result: room

main(){

int m;

char str1[100], str2[100];

printf("input string");

gets(str1);

printf("Which chracter that begin to copy?");

scanf("%d", &m); /*read and integer input and store in m*/

if (strlen(str1) < m)

printf("input error!");

else{

copystr(str1, str2, m);

printf("result: %s", str2);

getchar();

}

}

copystr(char *p1, char *p2, int m){

/* write your code here*/

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!