Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write an implementation of “float stringToFloat(char *str).”
The code should be simple, and not require more than the
basic operators (if, for, math operators, etc.).
• Assumptions
• Don’t worry about overflow or underflow
• Stop at the 1st invalid character and return the number
you have converted till then, if the 1st character is
invalid return 0
• Don’t worry about exponential (e.g. 1e10), instead you
should treat ‘e’ as an invalid character
• Write it like real code, e.g. do error checking
• Go though the string only once
• Examples
• “1.23” should return 1.23
• “1a” should return 1
• “a”should return 0

Answer Posted / fernando

If I have character buffer with many floats and want to
separate it as I do?

Example:

for (uint8_t i = 0; i < n; i++)
{
buf [i]; 25.45, 26.54,...
}
buf[0]=
buf[1]=
.
.
.
buf[n]=

Thanks.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you write a programmer for FACTORIAL using recursion?

1039


Explain can you assign a different address to an array tag?

1047


What is this pointer in c plus plus?

1084


What is variable in c example?

1066


What is static and auto variables in c?

1085


What is pass by value in c?

1067


What is an arrays?

1072


What are inbuilt functions in c?

1032


How is a structure member accessed?

1127


What is stack in c?

1075


Explain how do you override a defined macro?

1071


How many types of operator or there in c?

1089


a way in which a pointer stores the address of a pointer which stores the value of the target value a) reference b) allocation c) multiple indirection d) none

1150


Why clrscr is used in c?

1014


A character flag or control mechanism that delineates one data item from another a) variable b) constant c) delimiter d) call by reference

1106