Putting Strings Together
Posted by
Ravi Kumar at Friday, September 23, 2011
Share this post:
|
We cannot assign one string to another directly We
cannot join two strings together by the simple arithmetic
addition.
string3 = string1+string2;
string3 = string1+'hello"; are not valid.
The characters from string1 and string2 should be copied
into the string3 one after the other.The size of string3
should be large enough to hold the total characters.The
process of combining two strings together is called
concatenation.'C' does not permit the comparison of two
strings directly.
if(name1==name2)
if(name==''ABC") are not valid.
It is therefore necessary to compare the two strings
to be tested , character by character.
The comparison is
done until there is a mismatch or one of the string
terminates into a null character, whichever occurs first.