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

Code a simulation of image compression , Your task will be to code a simula...

Your task will be to code a simulation of image compression based on the approximate low rank structure of the set of image patches. You will write functions .code = my block compr

Describe url and hostname part, Describe URL and hostname part? The hos...

Describe URL and hostname part? The hostname part of the URL should be a valid Internet hostname. It can also be an IP address like as 204.29.207.217 or 128.235.252.184. The

Design and implement schemasusing xml schema, You are to build a Schema in ...

You are to build a Schema in XML Schema Language that will be used to support the development of the new central course information management system and other supporting applicati

Write a program to decrypt encrypted messages, You are working for a crypto...

You are working for a cryptography department, where one of your jobs is to decipher intercepted messages that have been encrypted using a book cipher. The messages are sent by dif

Java source code classes and objects, Design and implement a stringed music...

Design and implement a stringed musical instrument class using the following guidelines: a. Data fields for your instrument should include number of strings, an array of stri

Find the dual - duality theory and complementary slackness, Linear Programm...

Linear Programming Consider the following optimization problem: min x s.t. x ≥ max{a1, a2, . . . , an} Rewrite this problem as a Linear Programming Problem. What is the

Systems of differential equations, In this section we need to take a brief ...

In this section we need to take a brief look at systems of differential equations which are larger than 2 x 2. The problem now is not like the first few sections where we looked at

Differences between user and kernel level threads, Question : (a) Many ...

Question : (a) Many systems provide support for both user threads and kernel threads, resulting in different multithreading models. What are the two differences between user

ARM LANGUAGE, I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

Design program that presents animation of the solar system, Figure is a rep...

Figure is a representation of the solar system. In a basic model of the same concentric orbits planets rotate around the sun. The closer the Planet in less time Sun completes a ful

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