C Program to copy and concatenate strings without using standard functions.

C Program to copy and concatenate strings without using standard functions.
In this program , we copy one string from another, and without using the standard library function strcpy from string.h .
Here we appends the one string to another without using the strcat function. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact [email protected]
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/



#include <stdio.h>

void newStrCpy(char *,char *);
void newStrCat(char *,char *);

void main()
{
char str1[80],str2[80];
int opn;
do
{
printf("Press 1- NewStrCpy t 2- NewStrCatt 3- Exitt Your Option?");
scanf("%d",&opn);
switch(opn)
{
case 1: flushall();
printf("n Read the Source String n");
gets(str1);
newStrCpy(str2,str1);
printf(" Copied String: %sn",str2);
break;
case 2: flushall();
printf(" Read the First String n");
gets(str1);
printf(" Read the Second String n");
gets(str2);
newStrCat(str1,str2);
printf("Concatenated String: n");
puts(str1);
break;
case 3: printf(" Exit!! Press a key . . .");
getch();
break;
default: printf(" Invalid Option!!! Try again !!!n");
break;
}
}while(opn != 3);
} /* End of main() */

void newStrCpy(char *d,char *s)
{
while( (*d++ = *s++));
}
void newStrCat(char *s, char *t)
{
while(*s)
s++;
while(*s++ = *t++);
}

Read more c programs 
C Basic
C Strings

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com