Skip to content
Home » C Programs » C Program to Concatenate String Without Using Strcat

C Program to Concatenate String Without Using Strcat

Basic c program to concatenate string without using strcat. In this program we can execute string concatenation string without using strcat for beginners in c programming language.

String Definition in C

In C, a string is a character array followed by a NULL character, generally referred to as a C string. To symbolise a string, a series of characters is enclosed in double quotation marks (“). 

A string is a collection of characters encircled by double quotation marks. A string is a data type similar to an integer and a floating point unit that is used to represent text rather than numbers in programming. It is made up of a series of characters that may include spaces and numerals.

Strcat() Function in C

For string concatenation, the strcat() method is utilised. It joins the supplied string to another specified string at the end. The strcat function in the c programming language adds a copy of the string pointed to by s2 to the end of the string pointed to by s1. It returns a pointer to s1, which contains the concatenated string. In this program we have executed the c program to concatenate string without using strcat

C Program to Concatenate String Without Using Strcat

//c program to concatenate string without using strcat
#include <stdio.h>
int main()
{
char str1[100] = "Welcome to", str2[100] = "Inlarn";
char str3[100];
int i = 0, j = 0;
printf("\nFirst String %s", str1);
printf("\nSecond String %s", str2);
while (str1[i] != '\0') 
{
str3[j] = str1[i];
i++;
j++;
}
i = 0;
while (str2[i] != '\0') 
{
str3[j] = str2[i];
i++;
j++;
}
str3[j] = '\0';
printf("\nConcatenated String %s", str3);
return 0;
}

Output:

First String Welcome to
Second String Inlarn
Concatenated String Welcome toInlarn