I am not very familiar with C programming (I only did a few small projects in this language), but my professor said something about this behavior today, which confused me a bit.
He said that this code sometimes doesn’t print anything (I copied exactly what was on the board, I believe this is pseudo-code for C, since "print" is not in C):
int a = ___________; int b = ___________; if (a < b) print ("<"); if (a > b) print (">"); if (a==b) print("=");
Basically, there is something that you can store in those int variables where none of these conditions will be met ( ____ is not the actual code, obviously, it simply represents that there is something). It does not have to be some int number filling those gaps ... it could be anything in the world (and it could be something that happened before this code).
What can fill these gaps and not lead to any results, and why?
ps - is it somehow related to overflow, undefined behavior, an error outside the bounds, or something like that
pps - I have serious problems with this professor making a mistake. He is more knowledgeable about programming than anyone I have ever met. I am convinced that there are some cases where this is true.
source share