Computer Scientists are Pretty Pessimistic

Saturday 5 September 2015

WAP to copy a string into another string.

#include <stdio.h>
int main ()
{
    int i,j;
    char a[100],b[100];
    printf("Enter a string: ");
    gets(a);
    printf("Enter another string: ");
    gets(b);
    for(i=0;i<b[i];i++)
    {
        a[i]=b[i];
    }
    for(i=0;i<b[i];i++)
    {
        printf("%c",a[i]);
    }
    return 0;
}

No comments:

Post a Comment