This is not a bug. In the man page of the isdigit:
These functions check whether c, which must have the value of an unsigned char or EOF, falls into a certain character class according to the current locale. You should first test your value with a isascii if using isdigit. Your code has a major memory overflow risk: scanf("%d", &devisor); 1) Your test is wrong: while(isdigit(devisor)); does not do what you think. When you are giving it 21, it takes that code and says : the ASCII code 22 is not a digital value in the ASCII table. 2) scanf is really a dangerous function, because of this overflow issue, bad error handling. - better is scanf with a %s in a buffer that you parse afterwards with strtol for example (good for error testing) - even better, fgets which allows to minimize the bugs of your code by allowing error management. Jc On Thu, Jul 2, 2009 at 1:55 AM, vartan<vartan...@att.net> wrote: > dear maintainer: > the fallowing is a small sample of the code that contains all the info > to reproduce the problem. > the C library function isdigit() fails and causes segmention fault when > the input is is not numeric like xx. > > COMPILE COMMAND : >> gcc -ansi --version -Wall -o ch2-13.out -lm > ch2-13.c > gcc (Debian 4.3.2-1.1) 4.3.2 > Copyright (C) 2008 Free Software Foundation, Inc >