All pastes #939530 Raw Edit

agilman

public text v1 · immutable
·published 2008-03-12 11:18 UTC
rendered paste body
#include <stdio.h>
/*my_strncat concatinates at most n characters of t to s */
void my_strncat(char *s, char *t, int n)
{  
   char *temp;
   temp = s;
   for(;*temp!='\0';temp++)
      temp++;

   int i;
   for(i=0;i<n;i++){
      *temp++ = *t++;
   }

   s= temp;
   printf("%s\n", s);
}


int main()
{
   char charbuf[20]="abcdef";

   char *a = charbuf;
   char *b = "12345";
   
   my_strncat(a, b, (int) 2);

   return 0;
}