Tutorials, Free Online Tutorials,It Challengers provides tutorials and interview questions of all technology like java tutorial, android, java frameworks, javascript, core java, sql, php, c language etc. for beginners and professionals.

Breaking

C Program to Copy String Without Using strcpy()


  Copy String Without Using strcpy()


#include <stdio.h>
int main()
{
    char str1[100], str2[100], i;

    printf("Enter string str1: ");
    scanf("%s",str1);

    for(i = 0; str1[i] != '\0'; ++i)
    {
        str2[i] = str1[i];
    }

    str2[i] = '\0';
    printf("String str2: %s", str2);

    return 0;
}




Output:-


No comments:

Post a Comment