Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Review: Directives and Functions

Instructions: Think about each question and write the answer in your notebook.


Directives

1. What are the three parts of every C source code?

2. What does a preprocessor directive do?

3. What does a header file do?

4. What does <stdio.h> mean?

5. Where do we write preprocessor directives in a C program?


Functions

1. What is a function?

2. Why do we use void main( )?

3. What does the printf function do?

4. What is the difference between a main function and body function?


Escape Characters

1. What does \n do?

2. What does \t do?


White Box Testing

1. Fix the errors in this C source code. There are 4 errors.

include <stdio.c>
void main( )
{
printf("\nDusanabe is the capital of Tajikistan.")

2. Fix the errors in this C source code. There are 3 errors.

#include <stdio.h>
void ( )
printf("/nAsta Norregaard was a famous Impressionist painter in Norway.");
}

3. Fix the errors in this C source code. There are 3 errors.

#include <stdio.h
void main
{
printf("\nThere were many great Antarctic (South Pole) explorers:");
printf("\nRobert Scott \t Ernest Shackleton");
printf("\nRoald Amundsen /t Douglas Mawson");
}

Copyright
© 2001
Kristin Switala
Hosted by www.Geocities.ws

1