Date: Mon, 9 Mar 1998 15:49:27 -0800 (PST) Message-Id: <199803092349.PAA11543@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: brunobg AT geocities DOT com (Bruno Barberi Gnecco), djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: Struct gives a GPF Precedence: bulk At 08:54 3/7/1998 GMT, Bruno Barberi Gnecco wrote: >Hello! > I've got a problem when running a program. It worked well, but then I >added a second struct, and it shows this error: >#include >#include >#include >#include >#define min(b,c) (((b) <= (c)) ? (b) : (c)) >#define max(b,c) (((b) >= (c)) ? (b) : (c)) > >int main() { > struct motorista { > int pontos, dia, mes, ano, carteira; > }; > struct multa { > int infr, dia, mes, ano; > }; > int tabela[] = {0, 4, 5, 5, 7, 7}; > struct motorista mot[3]; > int count; > struct multa database[20]; > int *point, *infr, *temp; > > mot[0].pontos = 0; > mot[1].pontos = 0; > mot[2].pontos = 0; > mot[0].carteira = 0; > mot[1].carteira = 0; > mot[2].carteira = 0; > > for ( count = 0; count < 20; count++ ) { > printf("Type the numbers: "); > scanf("%d %d %d %d", &database[count].infr, &database[count].dia, >&database[count].mes, &database[count].ano); > > if ( database[count].infr == 0 && database[count].dia == 0 && >database[count].mes == 0 && database[count].ano == 0 ) { > break; > } > *temp = database[count].infr; I don't see where you initialize `temp' to point to something... > *infr = tabela[*temp]; > printf("chegou aqui"); > *point = min(mot[1].pontos , mot[2].pontos ); Nor `point'. > if ( (mot[0].pontos + *infr)>19 && (mot[1].pontos + *infr)>19 && >(mot[2].pontos + *infr)>19) { Nor, even, `infr'. [snipped] Nate Eldredge eldredge AT ap DOT net