Q:

String concatenation in C

0

String concatenation in C

C program to concatenate two strings; for example, if the two input strings are "C programming" and " language" (note the space before language), then the output will be "C programming language." To concatenate the strings, we use the strcat function of "string.h", to dot it without using the library function, see another program below.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>
#include <string.h>
int main()
{
  char a[1000], b[1000];

  printf("Enter the first string\n");
  gets(a);

  printf("Enter the second string\n");
  gets(b);

  strcat(a, b);

  printf("String obtained on concatenation: %s\n", a);

  return 0;
}

output:

Enter the first string

programming

Enter the second string

skills

String obtained on concatenation:programmingskills

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now