#1
17th August 2010, 09:40 PM
|
|||
|
|||
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, 03:05 AM
|
|||
|
|||
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, 03:08 AM
|
|||
|
|||
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.. |
Related Topics: |
||
Thread | Replies | Last Post |
Confused in MCA or Language Course. What's better for me? | 29 | 3rd February 2013 02:44 PM |
|