Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

String Concatenation using strcat() function in C-Language

Tags: string


In this C program we will concatenate the source string at the end of the target string using strcat()fuction. The String will be given by the User.color>

strcat() function concatenates the source string which is source_str in this program, at the target string which is target_str in this program. strcat() takes two arguements.
Like : strcat(target_str,source_str);

Learn about different string functions and their use: Different String Functions

input:

The String.

output:

The input string and the concatenated string will be printed on the screen.

CODE---->



#include
#include
int main()
{
char source_str[100],target_str[100]="Hello ";
printf("Please, Enter the string: ");
gets(source_str);
strcat(target_str,source_str);
printf("\nSource String is: ");
puts(source_str);
printf("\nTarget String is: ");
puts(target_str);
return 0;
}


Download the C-Program file of this Program.

Don't just read, run on your pc !!!color>


RESULT :color>



Please, Enter the string: World

Source String is: World

Target String is: Hello World

--------------------------------
Process exited after 4.922 seconds with return value 0
Press any key to continue . . .




Images for better understanding : color>

Also On Youtube :color>




This post first appeared on ProgramJoy.blogspot.com, please read the originial post: here

Share the post

String Concatenation using strcat() function in C-Language

×

Subscribe to Programjoy.blogspot.com

Get updates delivered right to your inbox!

Thank you for your subscription

×