K & R C Programs Exercise 7-9.

K and R C, Solution to Exercise 7-9:
K and R C Programs Exercises provides the solution to all the exercises in the C Programming Language (2nd Edition). You can learn and solve K&R C Programs Exercise.
Write a C Functions like isupper() can be implemented to save space or to save time. Explore both possibilities. Read more about C Programming Language .
isupper: return 1 (true) if c is an upper case letter
Normal C function:

int  isupper(char c)
{
if (c >= 'A' && c <= 'Z')
return 1;
else
return 0;
}

This simple code tests the character is upper or lower , If the character within the range of ASCII upper case letters it returns 1, otherwise 0.
To save space or to save time using the macros is the best possibility
C Code:

#define isupper(c)  ((c) > = 'A' && (c) <= 'Z') ? 1:0

Macro version of isupper is more efficient because, there is no overhead of the function call and it uses more space because the macro is expanded in line every time it is invoked.

Read more c programs
C Basic
C Strings
K and R C Programs Exercise

You can easily select the code by double clicking on the code area above.

To get regular updates on new C programs, you can Follow @c_program

You can discuss these programs on our Facebook Page. Start a discussion right now,

our page!

Share this program with your Facebook friends now! by liking it

(you can send this program to your friend using this button)

Like to get updates right inside your feed reader? Grab our feed!

To browse more C Programs visit this link
(c) www.c-program-example.com

2 comments on “K & R C Programs Exercise 7-9.

Leave a Reply