All pastes #2046069 Raw Edit

Something

public text v1 · immutable
#2046069 ·published 2011-04-13 17:22 UTC
rendered paste body
#include <stdio.h>
#include <stdlib.h>

char *alternate(char c1, char c2, int n)
{
     char *temp;
     
     temp=(char *) malloc(n*sizeof(int));
     for (i=0,times=0;times<(n/2);times++,i+=2)
     {
         temp[i]=c1;
         temp[i+1]=c2;
     }
     if (n%2!=0)
        temp[n-1]=c1;
}