Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

String copy without using strcpy in c ?

 String copy without using strcpy in c ?  
 #include <stdio.h>  
 #include <conio.h>  
 int main()  
 {  
   char str1[100], str2[100], i;  
   printf("Enter string str1: ");  
   scanf("%str",str1);  
   for(i = 0; str1[i] != '\0'; ++i)  
   {  
     str2[i] = str1[i];  
   }  
   s2[i] = '\0';  
   printf("String str2: %s", s2);  
   return 0;  
 } 

 

Post a Comment

0 Comments