#include<stdio.h>
#include<string.h>
void concat(char[], char[]);
int main() {
char s1[50], s2[30];
printf("
Enter String 1 :");
gets(s1);
printf("
Enter String 2 :");
gets(s2);
concat(s1, s2); //call the function
printf("
Concated string is :%s", s1);
return (0);
}
//function to concatiate two string s1 and s2
void concat(char s1[], char s2[]) {
int i, j;
i = strlen(s1);
for (j = 0; s2[j] != ' '; i++, j++) {
s1[i] = s2[j];
}
s1[i] = ' ';
}
#include<stdio.h>
void main(void)
{
char str1[25],str2[25];
int i=0,j=0;
printf("
Enter First String:");
gets(str1);
printf("
Enter Second String:");
gets(str2);
while(str1[i]!=' ')
i++;
while(str2[j]!=' ')
{
str1[i]=str2[j];
j++;
i++;
}
str1[i]=' ';
printf("
Concatenated String is %s",str1);
}
Explanation:
#include<stdio.h>
#include<string.h>
void concat(char[], char[]);
int main() {
char s1[50], s2[30];
printf("
Enter String 1 :");
gets(s1);
printf("
Enter String 2 :");
gets(s2);
concat(s1, s2); //call the function
printf("
Concated string is :%s", s1);
return (0);
}
//function to concatiate two string s1 and s2
void concat(char s1[], char s2[]) {
int i, j;
i = strlen(s1);
for (j = 0; s2[j] != ' '; i++, j++) {
s1[i] = s2[j];
}
s1[i] = ' ';
}
#include<stdio.h>
void main(void)
{
char str1[25],str2[25];
int i=0,j=0;
printf("
Enter First String:");
gets(str1);
printf("
Enter Second String:");
gets(str2);
while(str1[i]!=' ')
i++;
while(str2[j]!=' ')
{
str1[i]=str2[j];
j++;
i++;
}
str1[i]=' ';
printf("
Concatenated String is %s",str1);
}
Explanation:
Code Example |
---|
C :: sort names in array in c |
C :: bubble sort |
C :: c exit |
C :: binary search tree of strings in c |
C :: malloc |
C :: bubble sort c |
C :: actionbar content color in android |
C :: c include delay |
C :: recursive in c |
C :: FCFS algorithm in c to find average turnaround time and waiting time |
C :: 2d array in c |
C :: powershell search big files |
C :: c to fahrenheit |
C :: command line arguments c |
C :: getline function in c |
C :: c file struct |
C :: atoi string to int |
C :: pointer c |
C :: bitwise operators |
C :: len of str vbs |
C :: do a barrel roll |
C :: how to do Employing defensive code in the UI to ensure that the current frame is the most top level window |
C :: findtotalcurtain |
C :: hgggggggggggggggg |
C :: Parsing using strtok |
C :: check if string is number c |
C :: transform yt video into background overlay |
C :: read from text file in c |
C :: tetris rotate shape |
C :: reap zombie process in c |