answersLogoWhite

0


Best Answer

Here You Are :

void String_Concate(char *Arr1, char *Arr2)

{

int r=0;

int c = String_Length(Arr1);

int x,p;

for(int i=0;Arr1[i];i++)

{

if((Arr1[i]== 32)(Arr1[i]=='\0'))

{r= i;

break;}

}

for(x = r,p =0;x<=c + String_Length(Arr2);x++,p++)

{

*(Arr1 + x) = *(Arr2 + p);

}

}

Have A nice Day

User Avatar

Wiki User

14y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

// stores srcL + srcR into dest

// NOTE: dest must be at least as large as srcL + srcR

void strConcat(const char* srcL, const char* srcR, char* dest) {

const int lengthL = strLength(srcL);

const int lengthR = strLength(srcR);

// copy srcL into front of dest

int i;

for(i = 0; i < lengthL; ++i) {

dest[i] = srcL[i];

}

// copy srcR into the rest of dest

for(i = 0; i < lengthR; ++i) {

dest[lengthL + i] = srcR[i];

}

dest[lengthL + i] = '\0';

}

// returns the number of characters in str

int strLength(const char* str) {

int length = 0;

// take advantage of the fact that all strings MUST end in a null character

while( str[length] != '\0' ) {

++length;

}

return length;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C program code for concatenation of string?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

C program to copy two strings in to a new string with out using stringcopy in borland c?

You can use so called concatenation of strings:{...string str1 = "something here";string str2 = " and something here";string newStr = str1 + str2;...}


How to write a C program for concatenation of two strings using stack?

#include #include using std::cin;using std::cout;using std::endl;using std::string;int main(void){string str1 = "nothing here";cout str1;string str2 = "neither here";cout str2;string srt = "result here";cout


What is the use of Reverse String in C program?

The use of the reverse string in C program is used to reverse the letters in the string. An example would be reverse me would be reversed to em esrever.


Why and operator can not be used in string of c program?

Any character can be used in string, except for \\0. char example [] = "A&amp;B|C";


C program plus copy of string to another?

strcpy


C plus plus program to perform string manipulation?

You do not need to program string manipulation as it is already part of the standard library. See std::string and std::wstring.


How do you write a c program to find a word in a string?

what is if(!(str[i]==32))


Write a c program using string concept enter a sting and replace the new string in to old string and find no of occurrence?

print c co com comp compu


How do you write a c program to find the smallest word in a string?

what is if(!(str[i]==32))


What is the program to create a string class which stores a string value in c plus plus?

C++ already provides a string class in the C++ standard template library. #include&lt;iostream&gt; #include&lt;string&gt; int main() { using namespace std; string s {"Hello world!"}; cout &lt;&lt; s &lt;&lt; endl; }


Do I need to write a program to find a substring in a given string in c plus plus?

No.


Can you use scanf to get a string to a c program?

Certainly. That's what sequence %s is good for.