String Concatenation in C


This program is about Concatenate and print the given string without using pre-define functions.

Source Code

#include<stdio.h>
int main()
{
  int i,j,n,k=0;
  char a[100],b[100],c[100];
  printf("\nEnter the First String:");
  gets(a);
  printf("\nEnter the Second String:");
  gets(b);
  printf("\nGiven First String:");
  puts(a);
  printf("\nGiven Second String:");
  puts(b);
  for(i=0;a[i]!='\0';i++)
  {
    c[k]=a[i];
    k++;
  }
  for(i=0;b[i]!='\0';i++)
  {
    c[k]=b[i];
    k++;
  }
  printf("\nConcatenate Value is:%s",c);
  return 0;
}
To download raw file Click Here

Output

Enter the First String:Tutor
Enter the Second String:Joe's
Given First String:Tutor

Given Second String:Joe's

Concatenate Value is:TutorJoe's

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes