Read OnLine C- Program Example

09_STRING
PRAC 3 PRAC 4
//strcpy() function in c -->
//copy content of one string to another
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{ char source[]="Imacc";
char target[20];
clrscr();
strcpy(target,source);

printf("\n Source String=%s",source);
printf("\n Target String=%s",target);
getch();
}
--------output-------
Source String=Imacc
Target String=Imacc
//strcat() function in c
//it concatenates two strings
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{ char source[]="Education";
char target[20]="Imacc";
clrscr();
strcat(target,source);

printf("\n Source String=%s",source);
printf("\n Target String=%s",target);
getch();
}
-------output--------
Source String=Education
Target String=ImaccEducation
Previous Next
Download Download