write a function called addChar() to insert 1 string of characters into another
ID: 3638145 • Letter: W
Question
write a function called addChar() to insert 1 string of characters into another string. the function should take 3 arguments as well such as: string to inserted, the original string, and the position in the orginl string where the insertion should begin. for example, the call addChar("for all", message,6) should insert the characters for all in message, starting at message[5]. the information compiled below is still outputting errors, looking for assistance in correcting the problems, thanks!#include <iostream>
using namespace std;
int addChar (char str1[5],char message[10]);
int main()
{
int g,h;
g=strlen(str1);
h=strlen(message);
for(i=0;i<(h+1)-p;i++) /*
{
message[g+h]=a[g]; */
g--;
}
for(i=0;i<g+1;i++) /*
message[p]=str1[i];
p++;
}
}
Explanation / Answer
// I only write function to do above whole work: // i have taken as str1[5]="For all",message[10]=Original string in this program ADDCHAR(char str1[5],char message[10],p) { int g,h; g=strlen(str1); h=strlen(message); for(i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.