plz answer.. a program that takes a string e.g. "345" and
returns integer 345
Answer Posted / vadivel t
The equalent code to atoi() library fuction which i hav
written, below.
#include<stdio.h>
#include<conio.h>
int MyAtoi(char *cptr);
main()
{
char *cptr = "123445";
printf("INTEGER EQU IS: %d\n", MyAtoi(cptr));
getch();
}
int MyAtoi(char *cptr)
{
int iptr = 0;
while((*cptr != '\0') && ((*cptr >= 48 && *cptr <= 57) ||
(*cptr == 32)))
{
if(*cptr != ' ')
iptr = (iptr * 10) + (*cptr - 48);
cptr++;
}
return iptr;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is volatile variable in c with example?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What is a wrapper function in c?
the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function
Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
What are the advantages of union?
Explain what are multidimensional arrays?
What does the function toupper() do?
What does a function declared as pascal do differently?
How do you initialize pointer variables?
What does c mean?
Explain how do you declare an array that will hold more than 64kb of data?
What are data types in c language?
Dont ansi function prototypes render lint obsolete?