Learn How to Program in C

by
Dr. Kristin Switala

Introduction

Directives

Variables

Conditionals

Loops

Arrays

Pointers

Strings

Functions

Structures


Site Map

Review: Strings (d)

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


White Box Testing

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

#include<stdio.h>
#include<string.h>
void main( )
{
char initial;
printf("What your first initial? ");
scanf(" %c", &initial);
if(alpha(initial) != 0)

printf("You should've typed only letters.");

else
printf("%c is your initial.", initial);

}

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

#include<stdio.h>
#include<type.h>
void main( )
{
char initial;
printf("What your first initial? ");
scanf(" %c", &initial);
if(isuper(initial) == 0)

printf("You should've used an upper case letter.");

else
printf("%c is your initial.", initial);

}

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

1