Programs must compile with no warnings or errors using:
gcc -std=c11 -pedantic -WallEach source file must start with a comment containing your name and a description.
References: printf format list; limits.h, float.h, errno.h, perror, tgmath.h, time.h
Write a C program which displays the names and values of the following constants from limits.h:
CHAR_BIT, CHAR_MIN, CHAR_MAX, SCHAR_MIN, SCHAR_MAX, UCHAR_MAX SHRT_MIN, SHRT_MAX, USHRT_MAX INT_MIN, INT_MAX, UINT_MAX LONG_MIN, LONG_MAX, ULONG_MAX LLONG_MIN, LLONG_MAX, ULLONG_MAXand also computes at run-time (without using any predefined constants or assumptions) and displays the value of UCHAR_MAX.
Write a C program which displays the names and values of the following constants from float.h:
FLT_MIN, FLT_TRUE_MIN, FLT_MAX, FLT_EPSILON DBL_MIN, DBL_TRUE_MIN, DBL_MAX, DBL_EPSILON LDBL_MIN, LDBL_TRUE_MIN, LDBL_MAX, LDBL_EPSILONand also displays the values of DBL_TRUE_MIN/2, stored in an double variable, and DBL_MAX*2, stored in a double variable.
Write a C program which computes and displays the value of sqrt(-1). Include <errno.h> and after calling sqrt() display the value of errno and also call perror().
Also compute and display the value of some tgmath.h function (your choice) with a valid input which produces a range error, i.e. overflow. Display the value of errno and also call perror().
Write a C program which displays the argument and result values of ctime() from time.h for the following argument values:
INT_MAX-1 INT_MAX INT_MAX+1 0 -1 INT_MINNote that computing INT_MAX+1 requires use of a data type larger than int, e.g. long long.
If you can, compile in 32-bit mode using gcc -m32
option
to see the problem.