Wednesday, March 20, 2013

Program to concatenate two strings

In string.h header file there is another function to manipulate string, The strcat() function is used to concat two strings. This function takes both strings as parameters and joins them.
Here is the example-


For concatenation of strings using strcmp(), size of first argument must be greater because strcmp() function appends the second string with the first string.
For example if we pass "John" as first string and "Singh" as second string then second string "Singh" will be appended with the first string "John" and after concatenation, value of first string will be "JohnSingh".

Powered by Blogger.