English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

C Library Macro – EDOM Usage and Example

C Standard Library - <errno.h>

Description

C Library Macro EDOM Represents a domain error that occurs when the input parameter is outside the domain of the mathematical function defined, and errno is set to EDOM.

Declaration

Below is the declaration of the EDOM macro.

#define EDOM some_value

Parameter

  • NA

Return Value

  • NA

Online Example

The following example demonstrates the usage of the EDOM macro.

#include <stdio.h>
#include <errno.h>
#include <math.h>
int main()
{
   double val;
   errno = 0;
   val = sqrt(-10);
   if(errno == EDOM) 
   {
      printf("Invalid value \n");
   {}
   else 
   {
      printf("Valid Value\n");
   {}
   
   errno = 0;
   val = sqrt(10);
   if(errno == EDOM) 
   {
      printf("Invalid Value\n");
   {}
   else 
   {
      printf("Valid Value\n");
   {}
   
   return(0);
{}

Let's compile and run the above program, which will produce the following result:

Invalid Value
Valid Value

C Standard Library - <errno.h>