All pastes #340459 Raw Edit

Someone

public text v1 · immutable
·published 2007-02-04 20:07 UTC
rendered paste body
#include <stdio.h>
#include <conio.h>
#include <string.h>

void copy(char *t,char *s, int len);

void main()
{
     char source[5];
     char target[5];
          
     printf("Enter the source string\n");
     scanf("%s", &source);
     
     
     copy(target, source, sizeof(target)); 
     
     printf("Target string =%s", target);
     
     getch();
}

void copy(char *t, char *s, int len)
{
     int count;
     while(*s!='\0' && count<(len-1))
     {
         *t=*s;
         s++;
         t++;
         count++;
     }
     *t='\0';
     
}