Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 08-12-2006, 06:54 PM   #1 (permalink)
In The Zone
 
Ishan's Avatar
 
Join Date: Jun 2005
Location: Bharuch,Gujarat,India
Posts: 366
Default C Programming


HOW TO CREATE MY OWN
atoi() function.
pls give me the logic.
its urgent.
__________________
When was the last time when you did something for the first time?
So many words for the broken heart.....

for world wars. ishangajera.blogspot.com
Ishan is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 08-12-2006, 07:44 PM   #2 (permalink)
In Pursuit of "Happyness"
 
kalpik's Avatar
 
Join Date: May 2005
Location: New Delhi
Posts: 3,432
Default Re: C Programming

One tip: The ASCII value of (char) '0' is (int) 48. So just make a loop and extract these values! Also remember that you have to do the units, tens, hundred math also!

int num=0;
for(i=0;i<strlen(string);i++)
{
num=num+(((int)string[i]-48)*pow(10,i));
}

I think the above code should work!
kalpik is offline  
Old 08-12-2006, 07:44 PM   #3 (permalink)
Human Spambot
 
tuxfan's Avatar
 
Join Date: Feb 2004
Location: Mumbai
Posts: 2,653
Default Re: C Programming

HINT: switch case, while()/for() loop, if..else

Or are you expecting code?
__________________
:: Free hosting and free domain names available in special cases. Conditions apply ::
tuxfan is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:41 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2