answersLogoWhite

0

char* strcat (char* destination, const char* source) {

char* return_value = destination; // temp destination for return

while (*(destination++) != '\0'); // find end of initial destination

while ((*(destination++) = *(source++)) != '\0'); // copy source to end of destination

return return_value; // return original value of destination

}

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

A Write the algorithm to concatenate two given strings?

a write the algorithm to concatenate two given string


Why pointer is used to reference a string of characters write C plus plus statements that display the text hello using pointer to a string notation?

We use a pointer to reference a string because a string is an array of characters where every element is a char (or a wchar_t if using UNICODE strings). Passing arrays by value would require the entire array to be copied, but passing a pointer variable to an array only copies the pointer, which is effectively the same as passing the array by reference. #include <iostream> int main() { char * psz = "hello"; // pointer to a null-terminated string. std::cout << psz; // pass the pointer (by value) to the insertion operator. return( 0 ); }


Write a c program to copy two strings using pointers?

nahi malum


How do you write the factor strings using exponents for 8x8x8x8x8?

8 = 23 85 = 215


You want to write a simple without using pointer or array c program which will print greatest number when you give 20 number?

i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?


Can you write a grammar for the language consisting of strings?

Yes, a grammar for a language consisting of strings can be written using production rules that define how strings can be formed. Each rule specifies how different parts of a string can be combined or modified. The grammar can include rules for creating basic strings, concatenating strings, repeating characters, and more complex patterns.


Should i added strings to my composition?

Yes, but only if you actually know how to write for strings.


How do you write a C program to copy to strings using pointers?

mystrcpy (char* dest, char* src) { while ((*dest++ = *src++) != '\0); }


How do you write talking strings in Cherokee?

syllabry


What is algorithm to write algorithm to the program to access a pointer variable in structure?

Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield


How do you write C plus plus string concat without builtin functions?

#include<iostream> #include<string> int main() { // the two strings to concatenate std::string str1 = "Hello "; std::string str2 = "world!"; // allocate memory to the concatenated string with null-terminator char* str3 = new char[str1.size() + str2.size() + 1]; // initialise a moving pointer char* p = str3; // copy from the first string memcpy( p, str1.c_str(), str1.size() ); // advance the pointer p += str1.size(); // copy from the second string memcpy( p, str2.c_str(), str2.size() ); // advance the pointer p += str2.size(); // set the null-terminator *p = 0; // print concatenated string std::cout << str3 << std::endl; // tidy up delete [] str3, str3 = NULL; }


Write javascript code to display a list of strings?

You need to put the strings in an array, and then loop through the array to output the strings. Something like this would be a simple example: ---------------- var strings = ["s1","s2","s3"]; for ( var i in strings ) { document.write( strings[i] ); }