Computer Science, asked by nishu6784, 3 months ago

WAP to copy one string to another string but without using any predefined function.​

Answers

Answered by renuthakur3333
1

Answer:

This program for string copy in c allows the user to enter any string or character array. Next, it will use For Loop to iterate each character in that string, and copy them into another character array.

/* C program to Copy String without using strcpy() */

#include <stdio.h>

#include <string.h>

int main()

{

char Str[100], CopyStr[100];

int i;

printf("\n Please Enter any String : ");

gets(Str);

for (i = 0; Str[i]!='\0'; i++)

{

CopyStr[i] = Str[i];

}

CopyStr[i] = '\0';

printf("\n String that we coped into CopyStr = %s", CopyStr);

printf("\n Total Number of Characters that we copied = %d\n", i);

return 0;

}

Explanation:

please mark me as brainlist

Similar questions