#1  
17th August 2010, 08:40 PM
Unregistered
Guest
 
Posts: n/a

How to add strings in C Language in just 2 lines of code?


can you send me how to add two strings in "c" language in just two line of code

it was the poor experience i am ever feel in my carrier

i don't want mention the company name

anybody having the answer please send me




  #2  
19th August 2011, 02:05 AM
pk827
 
Join Date: Apr 2011
Posts: 63
Default Re: How to add strings in C Language in just 2 lines of code?

hi Dear...

In C programming language, to add to Strings, also called Concatenation of two String, U have to first include String.h header file.
this header file actually contains the Definition of a Function, which is used to concatenate two strings. that Function is "strcat(parameters);"...
in the parameters, u have to pass two parameters, or two strings. the function will return the addition of Two Strings.

A small example is given here, check it out :

#include <stdio.h>
#include <conio.h>
#include <string.h>
int main() {
char st1[] = "India";
char st2[] = "Delhi";
strcat(st1, st2);
printf("The Concatenated string is: %s\n", st1);
getch();
return 0;
}


the above program will return "India Delhi"....

I hope it wud help U... Gud luck..
  #3  
19th August 2011, 02:08 AM
pk827
 
Join Date: Apr 2011
Posts: 63
Default Re: How to add strings in C Language in just 2 lines of code?

hi Dear...

In C programming language, to add to Strings, also called Concatenation of two String, U have to first include String.h header file.
this header file actually contains the Definition of a Function, which is used to concatenate two strings. that Function is "strcat(parameters);"...
in the parameters, u have to pass two parameters, or two strings. the function will return the addition of Two Strings.

A small example is given here, check it out :

#include <stdio.h>
#include <conio.h>
#include <string.h>
int main() {
char st1[] = "India";
char st2[] = "Delhi";
strcat(st1, st2);
printf("The Concatenated string is: %s\n", st1);
getch();
return 0;
}


the above program will return "India Delhi"....

I hope it wud help U... Gud luck..
Do you have any question? or have anything to say?



Related Topics:

Thread Replies Last Post
Confused in MCA or Language Course. What's better for me? 29 3rd February 2013 01:44 PM



Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0
Please also check: