2. Comments:-
• Comments are used in a programme to improve the
understanding.
• Comments are not executed, rather they are ignored by the
compiler.
• Comments help the programme to understand the various
operations of a program and serve as an aid to debugging and
testing.
• Single line comments start with // symbol and multiple line
comments are written within /* and */.
3. Header files:-
• A header file is a file with extension .h which contains C
function declarations and macro definitions to be shared
between several source files. There are two types of header
files: the files that the programmer writes and the files that
comes with your compiler
4. Character set:-
• The character set is the fundamental raw material of any
language and they are used to represent information. Like
natural languages, computer language will also have well
defined character set, which is useful to build the programs.
Alphabets. Uppercase letters A-Z.
• Characters are used to write tokens .these characters are defined
by the Unicode character set.
• The C Character set includes letter , digits, special characters
and white spaces as building blocks to form blocks to form
basic programming elements.
6. Tokens:-
• A programming token is the basic component of source code .
Character s are categorized as one of five classes of tokens that
describe their functions (constants, identifiers, operators,
reserved words, and separators) in accordance with. the rules of
the programming language
7. Keywords:-
•Auto:
• Defines a local variable as having a local lifetime.
• Keyword auto uses the following syntax:
• [auto] data-definition
• As the local lifetime is the default for local variables, auto keyword is
extremely rarely used.
•Break:
• Passes control out of the compound statement.
• The break statement causes control to pass to the statement following the
innermost enclosing while, do, for, or switch statement.
• The syntax is simply:
• break;
8. Const:-
• Makes variable value or pointer parameter unmodifiable.
• When const is used with a variable, it uses the following syntax:
• const variable-name [ = value];
• In this case, the const modifier allows you to assign an initial
value to a variable that cannot later be changed by the program.
For example,
9. Continue:-
• Passes control to the begining of the loop.
• continue causes control to pass to the end of the innermost
enclosing while, do, or for statement, at which point the loop
continuation condition is re-evaluated.
• The syntax is simply:
• Continue
Do/Do-while loop:-
• Keyword do is usually used together with while to make another form
of repeating statement.
• Such form of the loop uses the following syntax:
• do statement while (expression)e;
10. Enum :-
• Defines a set of constants of type int.
• The syntax for defining constants using enum is
• enum [tag] {name [=value], ...};
Float, double:-
• The keyword float usually represents a single precision floating point data
type, and double represents a double precision floating point data type. In
TIGCC, both float and double (and even long double) are the same. The TI-89
and TI-92 Plus use a non-IEEE floating point format called SMAP II BCD for
floating point values.
These values have a range from 1e-999 to 9.999999999999999e999 in
magnitude, with a precision of exactly 16 significant digits. Principally, the
exponent range may be as high as 16383, but a lot of math routines do not
accept exponents greater than 999.
11. For loop:-
• For-loop is yet another kind of loop. It uses for keyword, with
the following syntax:
• for ([expr1]; [expr2]; [expr3]) statement
Goto :-
• goto may be used for transfering control from one place to
another. The syntax is:
• Goto identifier; Control is unconditionally transferred to the
location of a local label specified by identifier. For example,
• Again: ... Goto Again;
12. While:-
• Repeats execution while the condition is true.
• Keyword while is the most general loop statemens. It uses the
following syntax:
• while (expression) statement
Basic data types (integer and
character:-
• Variables of type int are one machine-type word in length. They can
be signed (default) or unsigned, which means that in this
configuration of the compiler they have by default a range of -32768
to 32767 and 0 to 65535 respectively, but this default may be changed
if the compiler option '-mnoshort' is given. In this case, the range of
type int is -2147483648 to 2147483647 for signed case, or 0 to
4294967295 for unsigned case. See also short and long type modifiers
13. Identifiers:-
• Alphabets, digits, underscores are permitted.
• They must not begin with a digit.
• First character must be letter.
• They may also begin with an underscore.
• Uppercase and lower case letters are distinct.
• They can be of any length however the frist 8 characters are
treated as significant by the C compiler.
• Declared keywords cannot be used as variable.
16. Constants:-
Constant Type of Value Stored
Integer Constant Constant which stores integer value
Floating Constant Constant which stores float value
Character Constant Constant which stores character value
String Constant Constant which stores string value
17. Integer constants:-
• Any whole number value is an integer.
• An integer constant refers to a sequence of digits without a
decimal point.
• An integer preceded by a unary minus may be considered to
represent a negative constant
• Example: 0 -33 32767
There are three types of integer constants namely,
a) Decimal integer constant
b) Octal integer constant
c) Hexadecimal integer constant
18. Decimal Integer constant :-
• It consists of any combinations of digits taken from the
set 0 through 9, preceded by an optional – or + sign.
• The first digit must be other than 0.
• Embedded spaces, commas, and non-digit characters are not
permitted between digits.
• Valid: 0 32767 -9999 -23
Invalid:
12,245 - Illegal character (,)
10 20 30 - Illegal character (blank space)
19. •Octal Integer Constant :-
• It consists of any combinations of digits taken from the
set 0 through 7.
• If a constant contains two or more digits, the first digit must be
0.
• In programming, octal numbers are used.
• Valid: 037 0 0435
Invalid:
0786 - Illegal digit 8
123 - Does not begin with
zero
01.2 - Illegal character (.)
20. Hexadecimal integer constant :-
• It consists of any combinations of digits taken from the set 0 through 7 and
also a through f (either uppercase or lowercase).
• The letters a through f (or A through F) represent the decimal
quantities 10 through 15 respectively.
• This constant must begin with either 0x or 0X.
• In programming, hexadecimal numbers are used.
• Valid Hexadecimal Integer
Constant: 0x 0X1 0x7F
Invalid Hexadecimal Integer Constant:
0xefg - Illegal character g
123 - Does not begin with 0x
21. Unsigned integer constant:-
An unsigned integer constant specifies only positive integer value. It is used only to count
things. This constant can be identified by appending the letter u or U to the end of the
constant.
Valid: 0u 1U 65535u 0x233AU
Invalid: -123 - Only positive value
Long integer constant:-
A long integer constant will automatically be generated simply by specifying a constant that
exceeds the normal maximum value. It is used only to count things. This constant can be
identified by appending the letter l or L to the end of the constant.
Valid: 0l23456L 0x123456L -123456l
Invalid: 0x1.2L - Illegal character (.)
Short integer constant:-
A short integer constant specifies small integer value. This constant can be identified by
appending the letter s or S to the end of the constant.
Valid: 123s -456 32767S
Invalid:
12,245 - Illegal character (,)
10 20 30 - Illegal character (blank space
23. String constant:-
• It contains sequence of characters enclosed in double qutation
marks.
• String constants are enclosed in double quotes "". A string
contains characters that are similar to character literals: plain
characters, escape sequences, and universal characters.
• You can break a long line into multiple lines using string literals
and separating them using white spaces.
• Here are some examples of string literals. All the three forms
are identical strings.
• "hello, dear" "hello, dear" "hello, " "d" "ear"
24. Backslash character constants
(Escape sequences):-
• Enclosing character constants in single quotes works for most
printing characters
• .A few , however, such as carriage return, can't be. For this
reason, C includes special backslash character constants, so that
you may easily enter these special characters as constants.
• You should use the backslash codes instead of their ASCII
equivalents to help insure portability.
• List of backslash character constants are as follows:-
25. Code Meaning:-
• b Backspace
• f Form feed
• n New line
• r Carriage return
• t Horizontal tab
• " Double quote
• ' Single quote
• Backslash
• v Vertical tab
• a Alert(very small sound)
• ? Question mark
• N Octal constant (N is an octal
constant)
• xN Hexadecimal constant (N
is an hexadecimal constant)
•
26. Special symbols:-
• Parethesis ( ) : Used for surrounding cast types.
• Braces{ } : Used to initialize the arrays, used to define a block
of code.
• Brackets[ ] : Used to declare array types.
• Semicolon; : Used to separate statements.
• Comma,:Used to separate identifiers in a variable declaration.
• Ampersand & : Used to assign the address of the location of
variable. used in the scanf function.