Date: 2010nov25
Language: C++
Product: Visual C++
Q. Why is my program getting
Debug Assertion failed!
File: isctype.c
Line: 56
Expression:(unsigned)(c+1) <= 256
A. Probably because you are reading beyond your buffer.
This isn't a problem with VC++ ... it is helping you out.
For example this will cause this problem:
char buf[] = "abc";
for (char *p = buf;;p++) // Loop forever (bug on purpose)
{
if (isalnum(*p)) printf("alnum");
}
As you can see this faulty code will do isanum(buf[5]) which is beyond
what we have allocated. isalnum() or isdigit() or other is* function
will assert letting us know.
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment