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 .
Normal C function:
int isupper(char c)
if (c >= 'A' && c <= 'Z')
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
#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
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,
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!