Moved cond.c to folder LC21
This commit is contained in:
18
Appendix1/Assertion/Assertions.c
Normal file
18
Appendix1/Assertion/Assertions.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int x = 7;
|
||||
|
||||
/* Some big code in between and let's say x
|
||||
is accidentally changed to 9 */
|
||||
x = 9;
|
||||
|
||||
// Programmer assumes x to be 7 in rest of the code
|
||||
assert(x==7);
|
||||
|
||||
/* Rest of the code */
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user