Keywords / Reserve Words
• Keywords are predefined, reserved words used in programming that have special meanings to the compiler.
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.
▫ 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.
Variables
• The rules for forming variable names:
▫ They must begin with a letter or underscore (_) and can be
followed by any combination of letters (upper or lowercase), underscores, or
the digits 0–9.
• Now we know that, variables are placeholders used to store values.
Data Types & Constants
• In C, any number, single character, or character string is known as a constant.
• 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.
eg - 128 + 7 – 17
Statements
• A program statement is any valid expression (usually an
assignment or function call) that is immediately followed by a semicolon, or it
is one of the special statements like compound, statement, break, continue, do,
for , go to, if, return, switch, while and null statement.
Variable Declaration
• Declaration is done
by simply listing the variables before the terminating semicolon of the
definition.
• You can declare multiple variables in same type using a
single statement
• After declaring a variable with a type, you can add some
content or value to that variable.
• There are two ways to assign value to a variable:
▫ Assign the value directly in the program.
▫ Ask from user to
input a value and then assign that value.
0 Comments