I had an interview a while ago, one of the questions had to do with the assert command.
Lets say I had the below statement:
now obviously the function foo will return a garbage value since it will overflow, will assert be able to catch this, if not what do I need to prevent the program compiling?Code://main
assert(foo(MAXINT)) //is this the correct usage of assert?
//foo function
int foo(int i)
{
return i+1;
}