
04/03/2008, 09:05
|
 | | | Fecha de Ingreso: junio-2006
Mensajes: 1.662
Antigüedad: 18 años, 8 meses Puntos: 28 | |
Re: Control de errores en C Si:
Código:
#include <stdio.h>
int edad = 0;
int retorno;
char buffer[20];
int main (int nargs, char **args){
printf("¿Qué edad tienes?\n");
fgets(buffer, 20, stdin);
retorno = funcion_que_valida_y_convierte_a_entero(&edad, buffer);
if(retorno == ERROR)
printf("Has cometido un error bla bla bla");
else
printf("Tu edad es %d", edad);
return 0;
}
Saludos
__________________ Si crees que no tiene sentido, etonces probablemente lo tenga... :arriba: |