Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

concatenation of two strings

Status
Not open for further replies.

laloo

Technical User
Sep 25, 2001
1
IN
how to write aprogramme on concatenation of two strings in Clanguage
 

You can use the following function.

prototype:

char* strcat(char *str1,char *str2);

but here str1 should be big enough, such that the resultant string can fit in.


char* strcat(char *str1,char *str2) {

int i;
int j;

for(i=strlen(str1),j=0;str2[j]!='\0';i++,j++)
str1 = str2[j];

str2[j] = '\0';
}




 


I am sorry, donot use my first message.......

There are some currections......

use this........


prototype:

char* strcat(char *str1,char *str2);

but here 'str1' should be big enough, so that the resultant string can fit in.


char* strcat(char *str1,char *str2) {

int i;
int j;

for(i=strlen(str1),j=0;str2[j]!='\0';i++,j++)
str1 = str2[j];

str1 = '\0';
}






 
Hey chandrupm!
Use the code and /code tags btween [] to write your code lines. The TGML parser assumes italics when sees
Code:
[i]
in the text.
The only way i could write that was using the tags i mentioned.

And, why don't use strcat standard C function for that job? [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top