TG Telegram Group & Channel
C Language 👨‍💻 | United States America (US)
Create: Update:

142. Program to concatenate two strings using pointer.

#include <stdio.h>

void concatenator(char *str, char *substr) {

while (*str)
str++;

while (*substr) {
*str = *substr;
substr++;
str++;
}

*str = '\0';
}

int main() {

char str[100], substr[100];

printf("Enter the source string : ");
gets(str);

printf("\nEnter string to concatenate : ");
gets(substr);

concatenator(str, substr);

printf("String after concatenation is \"%s\"\n", str);

return 0;
}
@C_Codings

142. Program to concatenate two strings using pointer.

#include <stdio.h>

void concatenator(char *str, char *substr) {

while (*str)
str++;

while (*substr) {
*str = *substr;
substr++;
str++;
}

*str = '\0';
}

int main() {

char str[100], substr[100];

printf("Enter the source string : ");
gets(str);

printf("\nEnter string to concatenate : ");
gets(substr);

concatenator(str, substr);

printf("String after concatenation is \"%s\"\n", str);

return 0;
}
@C_Codings


>>Click here to continue<<

C Language 👨‍💻




Share with your best friend
VIEW MORE

United States America Popular Telegram Group (US)