setjmp() and longjmp() Functions in C Library

Question: What are setjmp() and longjmp() Functions in Standard C Library. Explain with Examples When to Use them Answer: ‘setjmp()’ and ‘longjmp()’ functions provide a powerful mechanism similar to ‘goto’ but not restricted to just current function. This mechanism is useful in situations where there’s a deeply nested function calls and when error gets detected, … Read more

advertisement

Date and Time Conversion Functions in C

Question: What are Date and Time Conversion Functions in Standard C Library Answer: We know that ‘time()’ function returns value of type ‘time_t’ which is a 32-bit signed value on many implementations. The value returned is no. of seconds from some arbitrary epoch, for ex. 00:00:00 January 1, 2014. In order to obtain current date … Read more

advertisement

What is Time of Day Function in C Library?

Question: What is Time of Day Function in Standard C Library? Answer: Standard library provides collection of functions for dealing with time of the day and current date. ‘time()’ function is prototyped below time_t time(time_t *returned_value); On many implementations, time_t value is defined as signed 32-bit quantity. Note that argument passed to ‘time()’ if not … Read more

advertisement

clock() Function in C

Question: What is Processor Time Function in Standard C Library? Answer: ‘time.h’ header provides a time function that returns amount of processor time used by the program since it began executing. Though this is just an approximation. If more precise time estimation is required, call the ‘clock()’ function at the beginning of main() and subtract … Read more

advertisement

Date and Time Functions in C

Question: What are Date and Time Functions in Standard C Library? Answer: Standard library gives a nice collection of functions which allow us to deal with date and time related computations. These include ‘clock()’ function which returns amount of processor time used by the program, ‘time()’ function returns no. of seconds from an arbitrary epoch, … Read more

advertisement

Ceil, Floor, Absolute Value and Remainder Functions in C

Question: What are Floor, Ceiling, Absolute Value and Remainder Functions in Standard C Library? Answer: Standard C Library defines ‘floor()’, ‘ceil()’, ‘fabs()’ and ‘fmod()’ functions with return values and their arguments as type ‘double’ because of greater range of double values over ‘integer’ values. These are prototyped as below, double floor(double value); double ceil(double value); … Read more

advertisement

What is Power Function in C Library?

Question: What is Power Function in Standard C Library? Answer: There are two functions in this family which are defined in ‘math.h’ header and are prototyped below double pow(double x, double y); double sqrt(double value); Power ‘pow()’ function returns x raised to power y. Since logarithms may be used to compute the exp. ‘x^y’, x … Read more

advertisement

Logarithmic and Exponential Functions in C Library

Question: What are Various Logarithmic and Exponential Functions in Standard C Library? Answer: Mentioned below are logarithmic and exponential functions defined in ‘math.h’ header. double log(double value); /* computes natural logarithm */ double log10(double value); double exp(double value); ‘log()’ function computes logarithm of given argument to the base e. This is called “natural logarithm”. ‘log10()’ … Read more

advertisement

Hyperbolic Functions in C Standard Library

Question: What are Different Hyperbolic Functions in Standard C Library? Answer: We have following hyperbolic functions defined and prototyped in ‘math.h’ header. double sinh(double angle); double cosh(double angle); double tanh(double angle); These functions return the hyperbolic sine, hyperbolic cosine and hyperbolic tangent of their arguments respectively. Each function takes angle, in radians, as its argument. … Read more

advertisement

Trigonometric Functions in Standard C Library

Question: What are Various Trigonometric Functions in Standard C Library? Answer: Following trigonometric functions are defined in ‘math.h’ header. double sin(double angle); double cos(double angle); double tan(double angle); double asin(double angle); double acos(double angle); double atan(double angle); double atan2(double x, double y); Recall that PI radians equals 180 degrees. Functions ‘sin()’, ‘cos()’ and ‘tan()’ take … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.