Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Answers to Review: Directives and Functions


Directives

1. preprocessor directives, main function, body functions

2. tells the compiler to add a header file before compiling

3. contains information about how the compiler should interpret the functions in the program

4. standard input output header file

5. on the first line


Functions

1. a command to do something

2. for simple programs which do not return any value

3. prints something on the screen

4. body functions go inside the body of the main function


Escape Characters

1. adds a blank line

2. adds a tab


White Box Testing

1. four errors:

  • line 1 has two errors; it should be: #include <stdio.h>
  • line 4 should end with a semicolon ;
  • line 5 should have a close curly brace }

2. three errors:

  • line 2 should be: void main( )
  • line 3 should be open curly brace: {
  • line 4 should have \n instead of /n

3. three errors:

  • line 1 should have a bracket > at the end
  • line 2 should have parentheses: void main( )
  • line 6 should have the tab like this: \t
Copyright
© 2001
Kristin Switala
Hosted by www.Geocities.ws

1