plz answer.. a program that takes a string e.g. "345" and
returns integer 345

Answer Posted / ramu

int f(char s[])
{
int num=0,i;
for(int i=0;s[i]>='0' && s[i]<='9';i++)
n=10*n+(s[i]-'0');
if(i<sizeof(s))
{
printf("Error String");
return 0;
}
return n;
{

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I completed my B.tech (IT). Actually I want to develop virtual object that which will change software technology in the future. To develop virtual object what course I have to take. can I any professor to help me.

1740


What is I ++ in c programming?

629


What is external variable in c?

614


Do you know the purpose of 'register' keyword?

642


what are enumerations in C

725






What does typedef struct mean?

663


Is the exit() function same as the return statement? Explain.

665


Calculate 1*2*3*____*n using recursive function??

1519


why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???

1520


How many types of arrays are there in c?

595


What is meant by preprocessor in c?

537


What is a void pointer in c?

609


When the macros gets expanded?

791


What is data types?

641


What is an operator?

658