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

Floating Point Functions in C Standard Library

Question: What are Different Floating-Point Functions in Standard C Library? Answer: Most of the floating-point functions defined in ‘math.h’ header take their arguments as double and return double values. These functions range from Trigonometric to Hyperbolic to Logarithmic and Exponential to Power functions to Floor, Ceiling, Absolute value and Remainder functions to String conversion functions. … Read more

advertisement

Which String Conversion Functions in Standard C Library Return Type “double” Values

Question: Which String Conversion Functions in Standard C Library Return Type “double” Values? Answer: Following two functions take string as arguments and convert them into double values. double atof(char const *string); double strtod(char const *string, char **ptr2loc); These are defined in ‘stdlib.h’ header. Notice that if second argument to ‘strtod()’ function is not NULL then … Read more

advertisement

String Conversion Functions in C

Question: What are Different String Conversion Functions in Standard C Library? Answer: We have following functions which take character string with valid integers as first argument and return integer and long integer respectively as function value. These perform base 10 conversions. int atoi(char const *string); long int atol(char const *string); Function given below long int … Read more

advertisement

Random and Pseudo Random Numbers in C

Question: What are Random and Pseudo-Random Numbers and how are they Used in a C Program? Answer: GNU provides facilities for generating ‘pseudo-random numbers’. These aren’t truly random; sequence of numbers generated repeats periodically, though, over a large period so that we generally ignore this. Where, actually, we need to use such numbers implies situations, … Read more

advertisement

Integer Functions in Standard C Library

Question: What are Various Integer Functions in Standard C Library? Answer: This group of functions return integer values. These functions comprise three categories viz. arithmetic, random numbers and string conversion functions. Arithmetic group of functions are prototyped below int abs(int value); long int labs(long int value); div_t div(int numerator, int denominator); div_t ldiv(long int numerator, … Read more

advertisement

What is Standard Library in C?

Question: What is Standard Library and How this Empowers a C Programmer Answer: Programming in C requires any C program to use various different functions for different requirements to be best taken care of. For ex. to copy a string ‘strcpy()’ library function, for printing formatted data to stdout, ‘printf()’ is used. There are several … Read more

advertisement

File Manipulation Functions in C

Question: What are File Manipulation Functions in C Language Answer: Functions which manipulate files without performing I/O with them are called file manipulation functions. They are prototyped below int remove(char const *filename); int rename(char const *oldname, char const *newname); ‘remove()’ function can be used to explicitly close/delete a file specified by argument. If the specified … Read more

advertisement

Temporary Files in C – tmpfile() and tmpnam()

Question: What are Temporary Files? Answer: Sometimes, a program can use a file to hold data temporarily. This file is deleted automatically when program is finished or we can explicitly close the file using ‘fclose()’ when it’s no longer required. The ‘tmpfile()’ function opens a unique temporary file in binary read/write (w+b) mode. It’s prototyped … Read more

advertisement

What are Stream Error Functions in C Language?

Question: What are Stream Error Functions in C Language? Answer: We have functions in ANSI C specification which are used to determine the state of a stream. These are prototyped below, int feof(FILE *stream); int ferror(FILE *stream); void clearerr(FILE *stream); ‘feof()’ returns TRUE if stream is currently at end of file. Well! We have already … 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.