#include<stdio.h> #include<conio.h> void copystr(char *, char *); int main() { char str1[50], str2[50]; printf("Enter the string: "); gets(str1); printf("\nString 1 = %s", str1); copystr(str2, str1); printf("\nString 2 = %s", str2); getch(); return 0; } void copystr(char *s2, char *s1) { while(*s1) { *s2 = *s1; s1++; s2++; } *s2 = '\0'; }
C program to concat 2 strings using pointer.
Reviewed by
on
December 25, 2019
Rating:
No comments: