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

What are the parts of c program?

622


What is the use of c language in real life?

520


What is floating point constants?

676


What does 3 periods mean in texting?

587


Explain b+ tree?

614






Create a simple code fragment that will swap the values of two variables num1 and num2.

797


write a program to print largest number of each row of a 2D array

1860


What is the difference between array and linked list in c?

589


Is this program statement valid? INT = 10.50;

677


Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3106


write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a

1444


Tell me about low level programming languages.

633


what are non standard function in c

1420


Why c is known as a mother language?

629


What is a program flowchart and explain how does it help in writing a program?

659