Question: C PROGRAM PLZ GIVE SAME OUTPUT DONOT GIVE IRRELVANT 1- WAP to implement atoi function Description: int my_atoi(const char *s) The function will recieve a
C PROGRAM PLZ GIVE SAME OUTPUT DONOT GIVE IRRELVANT
1- WAP to implement atoi function
Description:
int my_atoi(const char *s)
The function will recieve a string and covert the number stored in the string into exact integer number.
Return the number.
Pr-requisites:-
Functions
Pointers
Objective: -
To understand the concept of
Functions and Pointers
Inputs: - String, String and Integer Sample execution: - Test Case 1 : Enter a numeric string: 12345 String to integer is 12345 Test Case 2 : Enter a numeric string: -12345 String to integer is -12345 Test Case 3 : Enter a numeric string: +12345 String to integer is 12345 Test Case 4 : Enter a numeric string: +-12345 String to integer is 0 Test Case 5 : Enter a numeric string: 12345- String to integer is 12345 Test Case 6 : Enter a numeric string: abcd12345 String to integer is 0 Test Case 7 : Enter a numeric string: 12345abcd
String to integer is 12345
REQUSTED FILE in this format also needed
#include
int my_atoi(const char []);
int main() { char str[20]; printf("Enter a numeric string : "); scanf("%s", str); printf("String to integer is %d ", my_atoi(str)); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
