Basics of C
Basics of C
By Shilpa Chakravorty
General Aspect of ‘C’
C was originally developed in the 1970s, by Dennis Ritchie at
Bell Telephone Laboratories, Inc.
C is a High level , general –purpose structured programming
language. Instructions of C consists of terms that are very closely
same to algebraic expressions, consisting of certain English
keywords such as if, else, for ,do and while
C contains certain additional features that allows it to be used at a
lower level , acting as bridge between machine language and the
high-level languages.
This allows C to be used for system programming as well as for
applications programming
The Character set of ‘C’
C language consist of some characters set, numbers and
some special symbols. The character set of C consist of all the
alphabets of English language. C consist of
Alphabets a to z, A to Z
Numeric 0,1 to 9
Special Symbols {,},[,],?,+,-,*,/,%,!,;,and more
The words formed from the character set are building
blocks of C and are sometimes known as tokens. These
tokens represent the individual entity of language. The
following different types of token are used in C
1) Identifiers 2)Keywords 3)Constants
4) Operators 5)Punctuation Symbols
Identifiers
do if static while
Variables
• A variable is nothing but a name given to a storage area that our programs can
manipulate. Each variable in C has a specific type, which determines the size and
layout of the variable's memory; the range of values that can be stored within that
memory; and the set of operations that can be applied to the variable.
• The name of a variable can be composed of letters, digits, and the underscore
character. It must begin with either a letter or an underscore. Upper and lowercase
letters are distinct because C is case-sensitive. There are following basic variable
types −
Type Description
• char Typically a single octet(one byte). This is an integer type.
• int The most natural size of integer for the machine.
• float A single-precision floating point value.
• double A double-precision floating point value.
• void Represents the absence of type.
Constants
Integer constants
• A integer constant is a numeric constant (associated with number)
without any fractional or exponential part. There are three types of
integer constants in C programming:
Floating-point constants
• A floating point constant is a numeric constant that has either a
fractional form or an exponent form. For example:
2.0,0.0000234,-0.22E-5
Character constants
• A character constant is a constant which uses single quotation
around characters. For example: 'a', 'l', 'm', 'F'
String constants
• String constants are the constants which are enclosed in a pair
of double-quote marks. For example: "good" ,"x","Earth is
round\n"
Escape Sequences