Страницы

Translate

суббота, 30 ноября 2013 г.

Exercise 7.9. Functions like isupper can be implemented to save space or to save time. Explore both possibilities



Exercise 7.9. Functions like isupper can be implemented to save space or to save time.
Explore both possibilities.



#include <ctype.h>

/* to save space */

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

/* to save time */

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


Комментариев нет:

Отправить комментарий