In computer programming, an assertion is a predicate (a true–false statement) placed in a program to indicate that the developer thinks that the predicate is always true at that place.
Assert is a macro which is used to check a condition during runtime and it is very much helpful in debugging #include <stdio.h> #include <assert.h> int main() { int a, b; printf(“Input two integers to divide\n”); scanf(“%d%d”, &a, &b) assert(b != 0); …………. ……… ….. } assert takes an expression and if the expression is true it continues the program otherwise throws an arrow indicating line no. and condition which does not hold true. |