Click here to Skip to main content
15,912,493 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
float toFloat(char st[]) - returns the float equivalent of st. Assume that st is a valid string representation of a float value. We were asked to make that function without using built-in functions in c and also without pointers. please help
Posted
Comments
ZurdoDev 3-Dec-14 9:31am    
Where are you stuck?
Member 11283203 3-Dec-14 10:17am    
I don't have an idea what to do
ZurdoDev 3-Dec-14 10:31am    
No one is going to write all of the code for you so you need to get to work and then let us know where you get stuck.
[no name] 3-Dec-14 12:04pm    
"and also without pointers"

The parameter st *is* a pointer (don't let the [] brackets fool you).

1 solution

You can do that in a single iteration over the string characters, it's just a multiply and add job.
 
Share this answer
 
Comments
Member 11283203 3-Dec-14 9:52am    
Do you have codes for this?
CPallini 3-Dec-14 15:56pm    
Nope, of course.
Member 11287281 14-Dec-14 2:49am    
Could u elaborate your problem more.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900