Major points
o program execution begins at main()
o keywords are written in lower-case
o statements are terminated with a semi-colon (;) called terminator
o text strings are enclosed in double quotes
o C is case sensitive, use lower-case and try not to capitalize variable names
o printf() can be used to display text to the screen and used for output
o sacnf() can be used to store any value in variable and used for input
o the curly braces {} define the beginning and end of a program/function block
Flounce of C Language
Alphabets Constant
Digit Variable Instructions Program
Special Symbol Keywords
Unchangeable value is called constant. Constants are quantities whose values do not change during program execution. They may be numeric or character.
Numeric Constant
Numeric constants are two types i.e. integer and real constant.
Inter Constants: -Integers represents values that are counted, like the number of students in a class. An integer constant is a string of digits that does not include commas or a decimal point. Some examples of valid integer constant are: 0, 7145, -225, -9528 etc
Rules for Integer Constant
An integer constant must have at least one digit.
It must not have a decimal point.
If no sign precedes an integer constant it is assumed to be positive.
No commas or blanks are allowed with in an integer constant.
The allowable range for integer constant is -32768 to 32767.
Real Constant (Floating-point Constant)
Real constant are often called floating point constant. The real constants are used to represent values that are measured, like the height of a person which have a value like 166.75 cm. The real constants could be written in two forms, exponential form and fractional form.
Rules for Real Constant
A real constant must have at least one digit.
It must have a decimal point.
It could be either positive or negative default sign is positive.
No commas or blanks are allowed with in a real constant.
Rules for Exponential Form
The mantissa part and the exponential part should be separated by a letter ‘e’.
The mantissa part may have a positive or negative sign.
Default sign of mantissa part is positive.
The exponential must have at least one digit which must be a positive or negative are integer.
Range of real constant expressed in exponential form is 3.4e38 to 3.4e38.
Character Constant
A character constant in one of the symbols in the a character ser. Although this character set may vary one C implementation to another, it includes digits (0-9), alphabets (a to z), symbols etc. a character constant is enclosed by single quotes such a s ’a’.
Rules for Character Constant
A character constant is a single alphabet, a single digit or a single special symbol enclosed with in a single Inverted Coma (‘).
Both the inverted comas should point to the left.
The length of character constant can be one character.
VARIABLE
Changeable value is called variable. When a variable is used in a computer program, the computer associates it with a particular memory location. A variable is a space in the computer memory set aside for a certain kind of data and given a name for reference.
Rules for Constructing Variable Name
A variable name is any combination of 1 to 8 alphabets, digits or under score.
The first character in the variable must be an alphabet or underscore.
No commas or blanks are allowed in variable name.
No special symbol other than an underscore can be used in a variable name.
KEYWORDS
Keywords are the words meaning has already been explained to the compiler. The keywords cannot be used as a variable name if we do so we are trying to assign a new meaning to the keyword, which are not allowed by the computer. There are only 32 keywords available in C.
(1) auto (2) break (3) case (4) char (5) const (6) continue (7) default (8) do (9) double (10) else (11) enum (12) extern (13) float (14) far (15) for (16) goto (17) if (18) int (19) long (20) near (21) register (22) return (23) short (24) signed (25) static (26) struct (27) switch (28) typedef (29) union (30) unsigned (31) void (32) while.
No comments:
Post a Comment