Skip to content

Commit c9fcf8a

Browse files
committed
string copy with functions and without functions c-basics
1 parent 3f2c25a commit c9fcf8a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

stringcopywithfunwithoutfun.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include<stdio.h>
2+
#include<string.h>
3+
void main()
4+
{
5+
char s[100],d[100];
6+
int i,j=0;
7+
printf("Enter the string\n");
8+
gets(s);
9+
printf("String copy (without function) ");
10+
for(i=0;s[i]!='\0';i++)
11+
{
12+
d[i]=s[i];
13+
printf("%c",d[i]);
14+
}
15+
printf("\n");
16+
strcpy(d,s);
17+
printf("String copy (with function) ");
18+
puts(d);
19+
}
20+

0 commit comments

Comments
 (0)