- Keywords / Reserve Words
Keywords are predefined, reserved words used in programming that have special
meanings to the compiler. • As C is a case-sensitive language, all keywords
must be written in lowercase.
2.Identifiers
An identifier in C consists of a sequence of letters,
digits, or underscore characters.
• Identifiers are set when you declare variables, arrays,
enumerations, structures, union, typedef and functions.
• Identifier must be unique.
• They are created to give unique name to a entity to
identify it during the execution of the program.
• You can choose any name for an identifier (excluding
keywords).
• However, if you give meaningful name to an
identifier, it will be easy to understand and work on for you and your fellow programmers.
▫ A valid identifier can have letters (both uppercase and lowercase letters), digits and underscores.
▫ The first letter of an identifier should be either a
letter or an underscore.
▫ However, it is discouraged to start an identifier name with an underscore.
▫ There is no rule on length of an identifier.
▫ However, the first 31 characters of identifiers
are discriminated by the compiler.
Variable
• Programming language enables you to assign
symbolic names, known as variable names, for storing program computations and results.
• A variable name can be chosen by you in a
meaningful way to reflect the type of value that is to be stored in that variable.
• Variables can be used to store integers, floating-point numbers, characters, strings and even
pointers to locations inside the computer’s
memory.
▫ Examples for invalid Variable Names
sum$value - $ is not a valid character.
piece flag - Embedded spaces are not permitted.
3Spencer - Variable names cannot start with a
number.
int - int is a reserved word.
▫ You should always remember that upper- and
lowercase letters are distinct in C.
Therefore, the variable names sum, Sum, and SUM each refer to a different variable.
Data Types
The C programming language provides int, float and char as basic data types.
• Additionally there are double and _Bool types
available.
▫ int – for storing integral numbers.
▫ float – for storing floating-point numbers.
double – for storing double precision floating point numbers.
▫ char – for storing a single character.
▫ _Bool - for indicating an on/off, yes/no, or
true/false situation. For storing value 1 or 0.
Data Types & Constants
• In C, any number, single character, or character string is known as a constant.
▫ E.g. the number 58 represents a constant integer value.
▫ The character string "Programming in C is fun.\n" is an example of a constant character string.
• There are five different types of constants available in C programming language;
▫ Integer constants
▫ Floating point constants
▫ Character constants
▫ Character String Constants
▫ Enumeration Constants
Constant Expression
• Expressions consisting entirely of constant
values are called constant expressions.
▫ E.g. Expression 128 + 7 – 17 is a constant
expression because each of the terms of the
expression is a constant value.
▫ 128 + 7 – i would not represent a constant
expression beause i was represented as a variable.
Format Modifiers




0 Comments