Right Click to Search

Monday, January 18, 2025

Atoi Function >> Convert String of number into Integer


Atoi Function :
  • Atoi = A to I = Alphabet to Integer
  • Convert String of number into Integer
Syntax:
num = atoi(String);
num   - Integer Variable
String- String of Numbers
Example :
num = atoi("1947");
printf("%d",num);
Output :
1947
Significance :
  1. Can Convert any String of Number into Integer Value that can Perform the arithmetic Operations like integer
  2. Header File : stdlib.h 
Ways of Using Atoi Function :

Way 1 : Passing Variable in Atoi Function  
// Variable marks is of Char Type
int num;
char marks[3] = "98";
num = atoi(marks);
printf("\nMarks : %d",num);
Way 2 : Passing Direct String in Atoi Function
int num;
num = atoi("98");
printf("\nMarks : %d",num);

Tags / Keywords : | ,

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates