assert Macro

Purpose

Verifies a program assertion.

Library

Standard C Library (libc.a)

Syntax

#include <assert.h>

void assert ( Expression)
int  Expression;

Description

The assert macro puts error messages into a program. If the specified expression is false, the assert macro writes the following message to standard error and stops the program:

Assertion failed: Expression, file FileName, line LineNumber

In the error message, the FileName value is the name of the source file and the LineNumber value is the source line number of the assert statement.

Parameters

Item Description
Expression Specifies an expression that can be evaluated as true or false. This expression is evaluated in the same manner as the C language IF statement.