Computer Science, asked by jayanthimandapati27, 5 months ago

Design a C program to copy only n characters from str2 to str1 and find length of str1​

Answers

Answered by kalivyasapalepu99
0

Copy String Without Using strcpy()#include <stdio.h> int main() { char s1[100], s2[100], i; printf("Enter string s1: "); fgets(s1, sizeof(s1), stdin); for (i = 0; s1[i] != '\0'; ++i) { s2[i] = s1[i]; } s2[i] = '\0'; printf("String s2: %s", s2); return 0; }

Output

Enter string s1: Hey fellow programmer. String s2: Hey fellow programmer.

Similar questions