How do I determine whether a character is numeric, alphabetic, and so on?

The header file ctype.h defines various functions for determining what class a character belongs to. These consist of the following functions: Function Character Class Returns Nonzero for Characters isdigit() – Decimal digits – 0-9 isxdigit() – Hexadecimal digits – 0-9, a-f, or A-F isalnum() – Alphanumerics – 0-9, a-z, or A-Z isalpha() – Alphabetics – a-z or A-Z islower() – Lowercase alphabetics – a-z isupper() – Uppercase alphabetics – A-Z isspace() – Whitespace – Space, tab, vertical tab, newline, form feed, or carriage return isgraph() – Nonblank characters – Any character that appears nonblank when printed (ASCII 0x21 through 0x7E) … Click here to continue…..

What is the difference between a free-standing and a hosted environment?

Not all C programmers write database management systems and word processors. Some write code for embedded systems, such as anti-lock braking systems and intelligent toasters. Embedded systems don’t necessarily have any sort of file system, or much of an operating system at all. The ANSI/ISO standard calls these “free-standing” systems, and it doesn’t require them to provide anything except the language itself. The alternative is a program running on a PC or a mainframe or something in-between; that’s a “hosted” environment. Even people developing for free-standing environments should pay attention to the standard library. For one thing, if a free-standing … Click here to continue…..

What header files do I need in order to define the standard library functions I use?

The funny thing is, these are not necessarily the files that define what you’re looking for. Your compiler guarantees that (for example) if you want the EDOM macro, you can get it by including <errno.h>. EDOM might be defined in <errno.h>, or <errno.h> might just include something that defines it. Worse, the next version of your compiler might define EDOM somewhere else. Don’t look in the files for the definition and use that file. Use the file that’s supposed to define the symbol you want. It’ll work. A few names are defined in multiple files: NULL, size_t, and wchar_t. If … Click here to continue…..

Why should I use standard library functions instead of writing my own?

The standard library functions have three advantages: they work, they’re efficient, and they’re portable. They work: Your compiler vendor probably got them right. More important, the vendor is likely to have done a thorough test to prove they’re right, more thorough than you probably have time for. (There are expensive test suites to make that job easier.) They’re efficient: Good C programmers use the standard library functions a lot, and good compiler vendors know that. There’s a competitive advantage for the vendor to provide a good implementation. When competing compilers are compared for efficiency, a good compiler implementation can make … Click here to continue…..

Loops

The versatility of the computer lies in its ability to perform a set of instructions repeatedly. This involves repeating some portion of the program either a specified number of times or until a particular condition is being satisfied. This repetitive operation is done through a loop control instruction. There are three methods by way of which we can repeat a part of a program. They are: Using a for statement Using a while statement Using a do-while statement Each of these methods is discussed in the following pages.