Home » C Programs » String Concatenation in C Without Using Strcat

String Concatenation in C Without Using Strcat

String concatenation in c without using strcat. String concatenation is the operation of joining character strings end-to-end in formal language theory and computer programming. This will concatenate the pointer values in c.

Gets Function in C

The gets() function allows the user to enter a string of characters followed by the enter key. A character array is created to hold all of the characters entered by the user. To convert the array to a string, the null character is added. The user can enter space-separated strings using the gets() function. 

Puts Function in C

In C/C++, the puts() function is used to write a line or string to the output (stdout) stream. It returns an integer value after printing the passed string with a newline. The value of the return is determined by the success of the writing procedure.

Pointer in C

In C, a pointer is a variable that stores the address of another variable. This variable can be of any type, including int, char, array, function, or pointer. The pointer’s size is determined by the architecture. However, in 32-bit architecture, a pointer is 2 bytes in size.

While Loop in C

A while loop is a control flow statement in most computer programming languages that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be viewed as a looping if statement. 

String Concatenation in C Without Using Strcat

//string concatenation in c without using strcat
#include <stdio.h>
int main()
char firstelement[100], secondelement[100];
printf("\nEnter the first string: ");
printf("\nEnter the second string to be concatenated");
char *a = firstelement;
char *b = secondelement;
*a = *b;
*a = '\0'; 
printf("The string after concatenation is: %s ", firstelement);
return 0;


Enter the first string: inlarn

Enter the second string to be concatenateddotcom

The string after concatenation is: inlarndotcom