Program converts character array to signed decimal integer, Programming Languages

Assignment Help:

1. Write a function that converts a character array to a signed decimal integer. Function prototype must be as follows: int asciiToInt( char *str, unsigned char* eflag)

YOU MAY NOT USE THE LIBRARY ATOI AND ATOF FUNCTIONS, but you may use any string library function.

The function must only have two parameters. str is the character string to be converted.

a) If the string has any leading non-numeric characters other than + or -, your function should print an error message, set eflag to 1, and return 0.

b) Any non-digit characters other than 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 should also result in an appropriate error message, setting the eflag to 1 and returning 0.

c) Otherwise, your function should convert numeric ascii character string to the appropriate signed integer value. The eflag should be zero for a successful conversion. Return the signed integer value.

d) Examples of invalid strings:

A10

1239z45

e) Examples of valid strings:

+123

-99

12

0

For an entry such as -0, return 0.

f) Include comments in the form:

/** Function name:

*

* Desription:

* Input:

* Output:

*/


Related Discussions:- Program converts character array to signed decimal integer

Computer design project , I''m studying electrical engineering, and this se...

I''m studying electrical engineering, and this semester im taking course that called Computer Design. in this course they need me to a final project about any thing we took during

Develop a program on behavior of hospital personnel, A psychologist is inte...

A psychologist is interested in learning about the voting behavior of college students.  (4 points for each part.)Design a study which would yield data on this topic. a. state y

Use case diagram incremental development, Introduction This assignment ...

Introduction This assignment builds on your application, produced in Assignment 1, which holds a list of cabins, which can be either read in from a text file or just hard coded

Assembly language programm , these 8 numbers (15, 20, 25, 30, 35, 40, 45, a...

these 8 numbers (15, 20, 25, 30, 35, 40, 45, and 50) with using conditional jump

Calculate the total price to purchase all the components req, Calculate the...

Calculate the total price to purchase all the components required to build a state-of-the-art gaming computer from components available on the internet. Before attempting this exer

Computers and programming concept, Computers and Programming Concept 1....

Computers and Programming Concept 1. Classify computer systems according to capacity. How they are different from computers according to the classification of technology. Provi

Program that takes names of 5 students in 2d character array, Write a progr...

Write a program that takes names of 5 students in 2D Character Array and their GPAs in 1D array. Arrange the names in alphabetical order and display on screen along with GPA.

How to write a kernel module, Overview You will write a loadable kernel...

Overview You will write a loadable kernel module. If you have an idea which you can convince me is a good idea that can not be done as a module, but only via direct modificatio

Software application, Does anyone know anything about java programming here...

Does anyone know anything about java programming here?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd