Get Started
879

Q: What do the functions atoi(), itoa() and gcvt () do? Show how would you use them in a program.

  • Show Answer
  • Workspace

Answer :
Explanation :

atoi()         Converts a string to an integer. itoa()         Convert an integer to a string gcvt()        Converts a floating-point number to a string   #include "stdlib.h" main() {       char s[] = "12345";       char buffer [15], string[20];       int i;              i = atoi (s);       printf("\n%d",i);          gcvt (20.141672, 4, buffer);        printf ("\n%s", buffer);          itoa(15, string,2);         printf ("\n%s", string); }

The Most Comprehensive Exam Preparation Platform

Get the Examsbook Prep App Today