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
/* USER NAME : vartan
 * DATE STARTED : Wed Jul 01 19:28:34 2009
 *
 * COMPILE COMMAND : gcc -ansi --version -Wall  -o ch2-13.out    -lm ch2-13.c */

/* INCLUDE FILES */

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>

/* PREPROCESSOR CONSTANTS */


 int main(void){         /* start of main */

 int  i = 1,
      devisor, j = 0;
 
 do {
 
    printf("Please enter a valid numeric for devisor\n");
    scanf("%d", &devisor);
 }
 while (isdigit(devisor));
 
  
 printf ("counting\n");
 while (i <= 100)
 {
   if (!( i++ % devisor))
   {
      printf("%4d",(i-1));            /* point to the correct line number that is devidable by devisor*/
      printf(" *\n");
      j++;
   }
   else
       ;

 }                          /* end of while */
   printf("\n The number of lines that is dividable by %d was %d.\n", devisor,j);

  return(0);

 }                         /* end of main */



Reply via email to