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
What is the difference between c &c++?
How #define works?
What is the difference between exit() and _exit() function?
What is extern c used for?
Why static is used in c?
What is the difference between void main and main in c?
What is pointers in c with example?
How can I invoke another program or command and trap its output?
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
What does char * * argv mean in c?
How do you use a 'Local Block'?
What is the difference between Printf(..) and sprint(...) ?
write a program to display all prime numbers
Why enum is used in c?
Why & is used in c?