c concatenate strings
char str[80];
strcpy(str, "these ");
strcat(str, "strings ");
strcat(str, "are ");
strcat(str, "concatenated.");
c concatenate strings
char str[80];
strcpy(str, "these ");
strcat(str, "strings ");
strcat(str, "are ");
strcat(str, "concatenated.");
how to combine strings in c
#include <stdio.h>
#include <string.h>
int main() {
char str[80];
strcpy(str, "these ");
strcat(str, "strings ");
strcat(str, "are ");
strcat(str, "concatenated.");
printf("%s\n", str);
}
program to concatenate two strings in c
// this program is to contenate strings without using string function
#include <stdio.h>
#include <string.h>
void concatenate(char *str1, char *str2)
{
int i = strlen(str1), j = 0;
while (str2[j] != '\0')
{
str1[i] = str2[j];
i++;
j++;
}
str1[i] = '\0'; // declaring the end of the string
}
int main()
{
char string1[20], string2[20];
gets(string1);
gets(string2);
concatenate(string1, string2);
printf("String 1 : ");
puts(string1);
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us