

The suffix u or U signifies the int to be an unsigned one. Note that a string constant is always enclosed within double quotes.Ī normal integer constant is written as 1234.Ī long int is recognized by the presence of L (uppercase or lowercase) at the end of the constant, e.g. The constants in C can be classified into four categories namely integer constants, floating point constants, character constants and string constants.Ī character constant is written as for example - 'A' (always enclosed in single quotes).Įxamples of string constants are - "Jamshedpur", "A", etc. Expressions used in a program combine the variables, constants and operators to produce new values. The operations that can be performed on the data objects are specified by a set of operators. The type of all the variables to be used in the program must be declared before they can be used. The data objects to be manipulated in a C program are classified as variables and constants. So char variables or constants can be used as integer data in arithmetic expressions. Each character has an equivalent integer representation (since each stores internally the ASCII value for the corresponding character).

The char type is used to represent individual characters, and occupies one byte of memory. In case of an ordinary int it is reserved for sign (sign bit), but all the bits in an unsigned int are used for determining the magnitude of the integer quantity. The unsigned int occupies the same memory space as an ordinary int but differs on the possible content of the left-most bit. Note that the qualifier unsigned can be used along with the qualifiers short and long. The qualified basic data types and their sizes are shown in table below. The memory requirement of an integer data varies depending on the compilers used. For example, an integer quantity can be defined as long, short, signed or unsigned integer. The list of data types can be increased by using the data type qualifiers such as - short, long, and unsigned. Single precision floating point number (number containing fraction & or an exponent) These are listed in the table below: Data type There are only few basic data types in C. The following names are not valid identifiers: The following are examples of valid identifier names: A, ab123, velocity, stud_name, circumference, Average, TOTAL Keywords like if, else, int, float, etc., have special meaning and they cannot be used as identifier names.

The underscore character (_) can also be included, and it is treated as a letter. Upper and lowercase letters are however not interchangeable (i.e., an uppercase letter is not equivalent to the corresponding lowercase letter). Both upper and lowercase letters are permitted. An identifier consists of letters and digits, in any order, except that the first character must be a letter. Identifiers are names given to various items in the program, such as variables, functions and arrays. These character combinations are known as escape sequences. In addition certain combinations of these characters, such as '\b', '\n' and '\t', are used to represent special condition such as backspace, newline and horizontal tab, respectively.

Most versions of the language also allow some other characters, such as and $, to be included within strings and comments.
