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

Design a game in c, Design a game in c: const DODGERS = 0; const GI...

Design a game in c: const DODGERS = 0; const GIANTS = 1;   void main(void) {    int scoreboard [2][9];    // An array two rows by nine columns    int team, i

Board coloring, coloring of elements in matrix form inm particular matrix.t...

coloring of elements in matrix form inm particular matrix.the color should not match with another color.

HASHING, What is meant by open addressing? Explain various collision resolu...

What is meant by open addressing? Explain various collision resolution techniques with example

Compute the average of five numbers, Step 1 Define the program headers and ...

Step 1 Define the program headers and the variables      #include   #include   #include   #include void main()   {       char prompt;     float a,b,c,d,e;     floa

Explain string constants in c language - escape sequences, Explain string c...

Explain string constants in c language - Escape Sequences? Illustrations are "945", "hello", "well done", "5+3". The character constant (example 'x') isn't equivalent to the st

#psuedocode, Create a pseudocode in getting Calendar Quarter. The program s...

Create a pseudocode in getting Calendar Quarter. The program should identify which quarter falls the given date. Note: Consider the date format DDMMYYYY.

Define statements to define the constants, the problem description. The ...

the problem description. The order of the C Program should be as follows: Variables and constants Use #define statements to define the constants. Use arr

OpenGL configured environment, 1. Using Visual C++ and your OpenGL co...

1. Using Visual C++ and your OpenGL configured environment, write an application that displays a “unique” graphical scene that you designed and coded for this course. What yo

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