Browse - Programming Tips - Debug Assertion fails: Expression:(unsigned)(c+1) = 256
Product: Visual C++
Q. Debug Assertion fails: Expression:(unsigned)(c+1) <= 256
Why is my program getting this debug assertion failed:
Debug Assertion failed!
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 isalnum(buf) which is beyond
what we have allocated. isalnum() or isdigit() or other is* function
will assert letting us know.