<div dir="ltr">Hola a todos, un comáñero tiene un código para hacer un RFC, le ayudé a hacerlo y no le veo ningún problema pero simplemente no funciona como nos gustaría que fuera. Aquí les dejo el código para que lo chequen y si encuentran algún error me lo puedan hacer saber. El código está en C, y el problema es que poniendo mis datos, sólo me salen las primeras 2 letras del RFC. <br>
<br><br><span style="color: rgb(0, 102, 0);">#include<stdio.h></span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">#include<string.h></span><br style="color: rgb(0, 102, 0);"><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">void FRFC(char *nombre, char *appaterno, char *apmaterno, char *dia, char *mes, char *ano);</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">char FEsvocal(char *appaterno);</span><br style="color: rgb(0, 102, 0);">
<br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">int main(void){</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    char nombre[11],appaterno[11],apmaterno[11],dia[2],mes[2],ano[4],*vocal;</span><br style="color: rgb(0, 102, 0);">
<br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    printf("Nombre: ");</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    scanf("%s",nombre);</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    printf("Apellido paterno: ");</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    scanf("%s",appaterno);</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    printf("Apellido materno: ");</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    scanf("%s",apmaterno);</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    printf("Dia: ");</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    scanf("%s",dia);</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    printf("Mes: ");</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    scanf("%s",mes);</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    printf("Ano: ");</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    scanf("%s",ano);</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    </span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    </span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    FRFC(nombre, appaterno, apmaterno, dia, mes, ano);</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    </span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    scanf("%s", ano);</span>  /* Esto lo puse solamente para detener la ejecución en la consola. No sé mucho de C y no sé cuál es el equivalente al 'cin.ignore()' de C++ */<br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    </span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    return 0;</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">}</span><br style="color: rgb(0, 102, 0);">
<br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">void FRFC(char *nombre, char *appaterno, char *apmaterno, char *dia, char *mes, char *ano){</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    char RFC[10];</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    </span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    RFC[0] = appaterno[0];</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    RFC[1] = FEsvocal(appaterno);</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    RFC[2] = apmaterno[0];</span>  /* Si aquí le pongo 'apmaterno[1]' sí me muestra el caracter correspondiente, pero así como está no muestra nada */<br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    RFC[3] = nombre[0];</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    RFC[4] = ano[2];</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    RFC[5] = ano[3];</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    RFC[6] = mes[0];</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    RFC[7] = mes[1];</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    RFC[8] = dia[0];</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    RFC[9] = dia[1];</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    </span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    printf("\nTu RFC es: %s", RFC);</span><br>
    /* Aquí mando a imprimir dentro de la función porque sinceramente no sé cómo devolver todo el arreglo y así poder imprimirlo en 'main()'. Sé que podría pasarle otro puntero a la función y modificar ese puntero y usarlo desde 'main()' pero como mi amigo no ha visto ese tema pues no quiero confundirlo */<br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">}</span><br style="color: rgb(0, 102, 0);"><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">char FEsvocal(char *appaterno){</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    char vocal;</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    int k;</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">    </span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    for(k=1;k<=3;k++){</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">        switch(appaterno[k]){</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">                case 'a':</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">                case 'e':</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">                case 'i':</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">                case 'o':</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">                case 'u':</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">                case 'A':</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">                case 'E':</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">                case 'I':</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">                case 'O':</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">                case 'U': return appaterno[k];            </span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">        }</span><br style="color: rgb(0, 102, 0);">
<span style="color: rgb(0, 102, 0);">    }</span><br style="color: rgb(0, 102, 0);"><span style="color: rgb(0, 102, 0);">}</span><br><br>Gracias de antemano.<br><br>
</div>