1.

Write short notes about conversion functions.

Answer»

The header file stdlib.h is used for conversion functions.

Following are the important conversion functions 

1. itoa(): 

It is used to convert an integer into a string. 

eg: 

int n = 100; 

charstr[20]; 

itoa(n,str,10);

2. Itoa(): 

It is used to convert an long into a string. 

eg: 

long n = 1002345L 

char str[20]; 

ltoa(n,str,10); 

3. atoi(): 

It is used to convert a string into integer

eg: 

int n; 

str[] = “123” 

n = atoi(str); 

4. atoll(): 

It is used to convert a string into long 

eg:

long n; 

str[] = “123456” 

n = atol(str);



Discussion

No Comment Found

Related InterviewSolutions