Strcat function in C
The char * strcat function (char * dest, const char * src) append the string pointed to by src, at the end of the string pointed to by dest.
The char * strcat function (char * dest, const char * src) append the string pointed to by src, at the end of the string pointed to by dest.
Declare the function strcat in C
Below is the declaration for strcat () in C:
char * strcat ( char * dest , const char * src )
Parameters
dest - This is the pointer to the destination array, which: should contain a string and should be large enough to contain the result string after being concatenated.
src - This is the string to be appended (append) at the end. This string should not overlap (stack) on the target string.
Returns the value
This function returns a pointer to the dest result string.
For example
The following C program illustrates the usage of strcat () in C:
#include #include int main () { char src [ 50 ], dest [ 50 ]; strcpy ( src , "Day la chuoi source (chuoi src)" ); strcpy ( dest , "Day la chuoi destination (chuoi dest) " ); strcat ( dest , src ); printf ( "Sau khi thuc hien ham strcat, chuoi dest la: n|%s|" , dest ); return ( 0 ); }
Compiling and running the above C program will result:
According to Tutorialspoint
Previous lesson: memset () function in C
Next lesson: strncat () function in C
You should read it
- Beginners of computer programming need to focus on what?
- Top 20 free programming learning websites need to bookmark immediately!
- Set of multiple choice questions about programming with P7 prize
- Set of multiple choice questions about programming with P11 prize
- P13 programming set of multiple choice questions
- Memset () function in C
- The strrchr () function in C
- Set of multiple choice questions about programming with P12
- Set of multiple choice questions for programming with P15 prize
- How to 'survive' with the stress of learning programming
- Set of multiple choice questions about programming with P10 prize
- Strcpy () function in C
Maybe you are interested
Revealing new findings about the size of the galaxy Admire incredibly detailed images of the Orion Nebula through the eyes of the James Webb telescope This star 'tears up' its companion to create a rare beautiful nebula Admire the moment millions of new stars are born in the Lupus 3 nebula Galaxy merger moment gives glimpse into Milky Way's future Top 15 free games on Steam gamers should experience