Showing posts with label C String Concatenation: strcat(). Show all posts
Showing posts with label C String Concatenation: strcat(). Show all posts

Thursday, July 5, 2018

C String Concatenation: strcat()

The strcat(first_string, second_string) function concatenates two strings and result is returned to first_string.





#include<stdio.h>
#include <string.h>
int main(){
char ch[10]={'h', 'e', 'l', 'l', 'o', '\0'};
char ch1[10]={'c', '\0'};
strcat(ch,ch1);
printf("Value of first string is: %s",ch);
return 0;
}



Output:

Value of first string is: helloc




Instagram