#include<stdio.h>
#include<ctype.h>
#include<string.h>
char *cambiar_frase(char frase[]){
    int cont=0,cont2=0,cont3=0;
    char aux[50];
    frase[cont]=toupper(frase[cont]);
    for(cont=0;frase[cont]!='\0';cont++){ 
        cont2=cont-cont3;   
        if(frase[cont]==' '){
             cont++;
             cont3++;
             frase[cont]=toupper(frase[cont]);
        }       
        aux[cont2]=frase[cont];
        printf(" cont=%d cont2=%d \n",cont,cont2);  
    }
    cont2++;
    aux[cont2]='\0';
    printf("%s",aux);   
    return;
}

main(){
    char frase[50];
    printf("Introduce frase a cambiar: ");
    gets(frase);
    cambiar_frase(frase);
    getchar();getchar();   
}