• +91 9723535972
  • info@interviewmaterial.com

C Interview Questions and Answers

Question - How can I convert a number to a string?

Answer - The standard C library provides several functions for converting numbers of all formats (integers, longs, floats, and so on) to strings and vice versa The following functions can be used to convert integers to strings: Function Name Purpose itoa() Converts an integer value to a string. ltoa() Converts a long integer value to a string. ultoa() Converts an unsigned long integer value to a string. The following functions can be used to convert floating-point values to strings: Function Name Purpose ecvt() Converts a double-precision floating-point value to a string without an embedded decimal point. fcvt() Same as ecvt(), but forces the precision to a specified number of digits. gcvt() Converts a double-precision floating-point value to a string with an embedded decimal point. Is it possible to execute code even after the program exits the main() function? The standard C library provides a function named atexit() that can be used to perform cleanup operations when your program terminates. You can set up a set of functions you want to perform automatically when your program exits by passing function pointers to the at exit() function.

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners