google.com, pub-6167773875660516, DIRECT, f08c47fec0942fa0 Write a c program to concatenate two strings - 2nd puc computer science

Write a c program to concatenate two strings

write a c program to concatenate two strings,write a c program to concatenate two strings using strcat,c program to concatenate two strings using library functions,c program to concatenate two strings using functions,write a program to concatenate two strings in c

Write a c program to concatenate two strings

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main()

{

char s1[10]="Lot";

char s2[10]="us";

strcat(s1,s2);

printf("Concatenated string is %s",s1);

getch();

}

Output:

Concatenated string is Lotus 

Write a c program to concatenate two strings without using built-in function

write a c program to concatenate two strings without using strcat,string concatenation function in c without using strcat,write a program to concatenate two strings without using inbuilt functions,c program to concatenate two strings without using library functions,c program to concatenate two strings using user defined function,conatenate two string in c without using strcat

#include<stdio.h>

#include<conio.h>

#include<string.h>

void concatenate(char str1[],char str2[]);

void main()

{

char s1[30],s2[30];

clrscr();

printf("Enter the first string: ");

gets(s1);

printf("Enter the second string: ");

gets(s2);

concatenate(s1,s2);       //function call

printf("Concatenated string: %s",s1);

getch();

}

void concatenate(char str1[],char str2[])

{

int l1,l2,i;

l1=strlen(str1);

l2=strlen(str2);

for(i=0;i<l2;i++)

str1[l1+i]=str2[i];

str1[l1+l2]='\0';

}

Output:

Enter the first string: Love

Enter the second string: Programming                                            

Concatenated string: LoveProgramming                                            

Write a c program to concatenate two strings Write a c program to concatenate two strings Reviewed by Vision Academy on December 13, 2021 Rating: 5

No comments:

CheckOut

Powered by Blogger.