Título: [AYUDA] PROBLEMA CON ARRAYS Publicado por: aradxc56 en 18 Marzo 2019, 12:53 pm Me gustaria saber como soluciono este error de compilado , llevo horas buscando y no lo encuentro :-(
paso codigo: #include <stdio.h> #include <stdlib.h> struct { char *nick,*nombre,*pswd; int nivel,vida,escudo; }jug; enum estado{OFF,ON,EJ,EE,GO}; enum acceso{ADM,JGD}; int main ( void ){ FILE *jugadores ; struct jug registrojug[34];// AQUI ME FALLA int i,jug,j; char palabra[15],cad[80]; jugadores= fopen( "jugadores.txt" , "a" ); if ( jugadores == NULL ){ printf( "Error en la creacion del archivo" ); } while ( jug == 1 ){ printf( "Introduce los datos del jugador\n\n" ); printf( "1º Introduce el nick\n" ); printf( "2º Introuduce el nombre\n" ); printf( "3º Intoduce la contraseña (debe tener minimo 8 caracteres)\n\n" ); for( i = 0 ; i < 11 ; i++ ){ if ( i == 1 ){//para el nick scanf( "%s", ®istrojug[j].nick ); fflush( stdin ); sprintf( cad, "%s", registrojug[j].nick ); fputs( cad, jugadores ); } if ( i ==2 ){ scanf( "%s", ®istrojug[j].nombre ); fflush( stdin ); sprintf( cad, "%s",registrojug[j].nombre ); fputs( cad, jugadores ); } if ( i == 3 ){ scanf( "%s", registrojug[j].pswd ); fflush( stdin ); sprintf( cad, "%s",registrojug[j].pswd ); fputs( cad, jugadores ); } if( i == 4 ){https://stackoverflow.com/questions/1102542/how-to-define-an-enumerated-type-enum-in-c fputs( "1", jugadores ); } if( i == 9 ){ fputs( "450", jugadores ); } if( i >= 10){ fputs( "0", jugadores ); } fputs( "/", jugadores ); } fputs( "\n", jugadores ); printf( "¿ Desea introducir otro jugador ?\n" ); printf( "si===>1 no===>cualquier cosa" ); scanf( "%i", &jug ); printf( "\n\n\n" ); } } Título: Re: [AYUDA] PROBLEMA CON ARRAYS Publicado por: MAFUS en 18 Marzo 2019, 15:54 pm Código: struct { jug es una variable de una estructura anónima, no un tipo de dato, por tanto no puedes hacer Código: struct jug registrojug[34]; Debes cambiar la declaración del tipo de estructura a Código: struct jug{ |