public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* segmention fault >> culprit is isdigit() c library function call
@ 2009-07-02 5:45 vartan
0 siblings, 0 replies; only message in thread
From: vartan @ 2009-07-02 5:45 UTC (permalink / raw)
To: gcc-bugs
[-- Attachment #1: Type: text/plain, Size: 303 bytes --]
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
[-- Attachment #2: ch2-13.c --]
[-- Type: text/x-csrc, Size: 919 bytes --]
/* 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 */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-07-02 5:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-02 5:45 segmention fault >> culprit is isdigit() c library function call vartan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).