Course list http://www.c-jump.com/bcc/

C functions and procedural programming


  1. Structured Programming
  2. Software design and implementation
  3. Functions
  4. Math library functions
  5. Character classification and conversion library functions
  6. Function parameters
  7. Function definitions
  8. Function definition format
  9. Problem with function definitions
  10. Problem with function definitions, cont.
  11. Solution: function declarations (prototypes)
  12. Make ping-pong better
  13. Communication between functions
  14. return from a void function
  15. Procedural programming highlights

1. Structured Programming



2. Software design and implementation

  • Idea...

  • Drawing board...

  • Vocabulary...

  • Features...

  • User interface...

  • Components:

    • variables

    • functions

  • Step-by-step approach:

    • incremental steps

    • compile often

    • test small changes

  • Variables:

    
    int card;
    int suite;
    int deck[ 52 ];
    double bank;
    int hand[ 6 ];
    int score;
    struct dealer;
    struct player;
    //etc...
    
    
  • Functions:

    
    shuffle( deck );
    deal( deck, hand );
    bet( 1.00 );
    hit( player );
    stand();
    //etc...
    
    

3. Functions



4. Math library functions



5. Character classification and conversion library functions



6. Function parameters



7. Function definitions



8. Function definition format



9. Problem with function definitions


  • 
    void ping() {
        //...
        pong();
        //...
    }
    
    
  • 
    void pong() {
        //...
        ping();
        //...
    }
    
    

10. Problem with function definitions, cont.



11. Solution: function declarations (prototypes)



12. Make ping-pong better



13. Communication between functions



14. return from a void function



15. Procedural programming highlights