Showing posts with label strcpy. Show all posts
Showing posts with label strcpy. Show all posts

20130505

How to copy a string without using strcp with pointer

/*How to copy a string without using library function strcpy.
How to use pointer/array to copy a string/sentence. C++/CPP/C program/code to copy a string/word/sentence without using inbuilt function strcpy.How copy a string without using library function strlen. cpp program to copy a string using pointer.cpp program to copy a string without using library function strcpy*/
#include<stdio.h>
#include<string.h>

void strCpy(char *p2,char *p1);

int main()
{
char arr1[20];
char arr2[20];
printf("Enter a String:\n");
scanf("%s",&arr1);

strCpy(arr2, arr1);

printf("You entered and copied:%s\n",arr2);