Advanced error checking and structures, C/C++ Programming

Assignment Help:

   It is standard on functions to provide some indication that the function has succeeded in its operation. Consider the Scanf function:

    scanf("%d",&number1);
 
If the function does indeed get a integer from the keyboard then everything is okay, but what happens if the user types in a char or float etc. The program might crash, it is common to write functions which never crash but return an error code. On the function scanf, the full prototype is

    int scanf("format",&variables);
 
The int is used to provide details of correct operation i.e. number of values  input or '-1' error . We can use this in programs to trap errors and repeat functions etc. The appended ANSI library shows full prototypes and meaning of return values from functions.


Related Discussions:- Advanced error checking and structures

#calculate percentge, #write a multilevel c++ program to take marks of 3 su...

#write a multilevel c++ program to take marks of 3 subjects and calculate percentage and display it

Flowchart, should i put define constant and memory constant in my flowchart...

should i put define constant and memory constant in my flowchart? the other one, how to draw flowchart for break and continue statement?

Reading from a Hash table in C, I''m having trouble with my C code to red f...

I''m having trouble with my C code to red from a Hash table. Not sure what it is I''m doing wrong and stumped. I need to get it figured out by tomorrow at 4:00 p.m. Eastern time. C

Write a program to act as an electronic safe, Write a program to act as an ...

Write a program to act as an electronic safe. If the correct code has been entered the program should display "Safe Open".  If an incorrect code is input it should display "Alarm"

Primary data type in cpp, What are  P r im a r y D a t a T y p...

What are  P r im a r y D a t a T y p es? Integer can be defined according to the size of the data and it can be modified further by using keyword unsigned and si

Stream input and output functions, Within C we access external devices by ...

Within C we access external devices by means of a pointer i.e. address. The address could point to any memory mapped device i.e. Ram, Rom, Duart, Disk drives etc. Therefore there i

Array, If an array holds integer, each of which is four bytes long, how man...

If an array holds integer, each of which is four bytes long, how many bytes from the base location of the array is the location of the fifth element?

C program to calculate area of cube, Aim: To implement program to calculat...

Aim: To implement program to calculate area of cube using inline function. Code: inline void area_cube(float side) {             float area;             are

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