Q:
         
         
            
               What do the functions atoi(), itoa() and gcvt () do? Show how would you use them in a program.
            
                      
         
             Answer
                        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);
}
          
         
         
         
             View answer
             Workspace
             Report Error
             Discuss