dhilst

Mix

mix.c

#include <stdio.h>
/*-*/

char *mix(const char *);

int main(){
char *p;
p = "hello world";
printf("%s\n", mix(p));
return(0);
}

char *mix(const char *p){
int c;
char *r, *s;
void *malloc();

r = s = (char *)malloc(sizeof p);
for(c = 0; *p != 0; c++, p++, r++){
if(c%2 == 0){
if(*p > 96 && *p < 123)
*r = *p -32;
else
*r = *p;
}else{
if(*p < 64 && *p > 91)
*r = *p +32;
else
*r = *p;
}
}
*++r = 0;
return(s);
}


OUTPUT:
HeLlO WoLrD