NIELIT COURSE

In this website you will cracked Computer CCC,CCC+,O-LEVEL,etc.


"Education Is The Key To Unlock The Golden Door Of Freedom"

INTRODUCTION TO "C" LANGUAGE


Data Types


 ✍The kind of data the variable may hold in a programming language is referred to as Data types. There are various type of data Integer,character,real,String,etc..Number without fraction represent Interger data type. Number with Fraction represent Real(float).Anything Enclosed in double Quotes(") Represent a String.

These are generally two type of data type.

Types of Data Types.

 ❶Primary Data types:-

(a):-Interger data type:-In this data type we use int keywords and use 2 byte memory in program.And use for numeric value to store in Program.

(b):-character data type:-In this data type we use char keywords and use 1 byte memory in program.And use for character value to store in Program.

(c):-float data type:-In this data type we use float keywords and use 4 byte memory in program.And use for fractional(decimal) value to store in Program.

(d):-double data type:-In this data type we use double keywords and use 8 byte memory in program.And use for fractional(decimal) value to store in Program.

(e):-void:- These are not a variable type data type and called a empty data type and use in function

 ❷Secondary Data types:-

(a):-Array

(b):-pointer

(c):-Structure

(d):-enum
..etc

Modifiers


✍Modifiers are keywords in c which changes the meaning of basic data type in c. It specifies the amount of memory space to be allocated for a variable. Modifiers are prefixed with basic data types to modify the memory allocated for a variable.These are divided in two type.

 ❶Sign type Modifiers:-

  When use the sign data type they effect the Rage of variable of data type.

 Note:-The Sign Modifiers use only with integer data type(int) & character data type(char)

(a):-Signed:- Store a Positive(+ve) and negative(-ve).
 Example:-1:- signed int a

(b):-Unsigned:- Store a Positive(+ve) value of variable.
 Example:-1:- Unsigned char a

 ❷Size type Modifiers:-

 When use Size modifiers they effect the size of data type.

 Note:-Size modifiers do not use with character type(char) & float data type(float).Only use with integer data type & Double data type.

(a):-short

 Example:-1:- When we put a variable int a  they use the size 2 byte.
       Use modifiers 1:- When we put a variable short int a  they use the size 2 byte.

(b):-long:- Use modifiers 1:- When we put a variable long int a  they use the size 4 byte.

(c):-long long

Operators


✍Operators are essential to form expression and to perform arithmetical and logical operations on variable. An operator on variable and perform an action in a program.It consist of words or symbol.Operators in C language may be calssified as.


 ❶Arithmetic Operators

 ❷Relational Operators

 ❸Logical Operators

 ❹Assignment Operators

 ❺Pointer Operators

 ❻Increment and Decrement Operators

 ❼Conditional Operator

 ❽Bitwise Operators

 ❾Special Operators


operands:-

•The data items that operators act upon to evaluate expressions are called as operands.

• Most operators require two or more operands while others act upon a single operand.

•Most operators allow the individual operands to be expressions.

• A few operators permit only single variables as operands.

• The operands can be integer quantities, floating-point quantities or characters


Arithmetic Operators:-

An Arithmetic Operators is a symbol which perform an arithmetical opration namely Addtion(+),Subtration(-),multipilication(*) and division(/),and Remaender(%).

Note:-All the arithmetic operators are,Binary Operator since they operate on Two Operands at a time.

Example:-8+4-3.......The + and - symbol are Operators and the Constants 8,4,3 are the Operands.

About Remainder Operator (%)-: -

The remainder operator (%) requires that both operands be integers and the second operand be nonzero. When one of the operands is negative,the sign of the first operand is the sign of the result operand.

Note:-The remainder operator (%) requires that both operands be integers only.

Example:- 11 % 3 = 2  -11 % 3 = -2   11 % -3 = 2   -11 % -3 = -2

About Division Operator (/)-:-

Division of one integer quantity by another is referred to as integer division. This operation always results in a truncated quotient (i.e., the decimal portion of the quotient will be dropped). If a division operation is carried out with two floating-point numbers or with one floating-point number and one integer, the result will be a floating-point quotient. The division operator (/) requires that the second operand be nonzero.

Note:- If a division operation is carried out with two floating-point numbers. or with one floating-point number and one integer, the result will be a floating-point quotient.

List of Arithmetic operators (Or) List of Binary operators-:-

 Oprators    Meaning

  +     Addition

  -     Subtration

  *     Multiplication

  /     division

  %      Modulo operation( remainder after integer division)

Example:-To write a program to Convert Temperature in Fahereheit to centigrade.



Relational Operators:-

Relational Operators,such as greater than(>)or less than(<) are used to compare value between two variable and thus form relational exapression.

List of Relational operators-:-

 Oprators    Meaning

  >     Greater than

  <     Less than

  >=     Greater than or equal to

  <=     Less than or equal to

  ==     Eual to

  !=     Not eual to

Note:-The Logical and Relational expression give the value "1" for TRUE result and the value "0" for FALSE result.


Logical Operators:-

The Logical Operators ,such as AND(&&),OR(||),NOT(!)..are used to connect Relational exapression togther using the rule of Boolean Algebra.

List of Logical operators-:-

 Oprators    Meaning

  &&    Logical AND

  ||     Logical OR

  !     Logical NOT


Assignment Operators:-

The Assignment operators is represented by the equal sign(=).The variable appearing on the Left side of equal(=)sign and it's assigned the value appearing on the right side of this sign.

List of Arithmetic assignment operators (Or) List of Shorthand assignment operators (Or) List of Compound assignment operators-:-

 Oprators    Meaning

  +=     Addition assignment

  -=      Subtraction assignment

  *=     Multiplication assignment

  /=     Division assignment

  %=      Modulus assignment


Pointer Operators:-

The Pointer operators are the Address-of operator(&) and the inderection operators(*).The pointer operators or inderection operators is used to get the contents of the address operand pointing to a particular memory element or cell. The & operators return the address of the variable.

List of Pointer operators-:-

 Oprators    Meaning

  *     Value at Operators or derefrence Operator(Gives Value stored at Particular Address)

  &     Address Operators or refrence Operator(Gives Address of Variable)


Increment and Decrement Operators:-

The Increment and Decrement operators in C are represented by ++ and -- sign respectivly. The operators ++ means"Add 1"the operators -- means "Subtract 1".

List of Increment and Decrement Operators-:-

 Oprators    Meaning

  ++      Increment by 1

  --     Decrement by 1


Conditional Operators:-

The Conditional Operators(?:) helps in building a simple conditional expression in the following form: Variable = expression_1? expression_2 : expression_3;

List of Conditional Operators-:-

 Oprators    Meaning

  ?:     Conditional operator


Bitwise Operators:-

A bit is the smallest possible unit of data storage,and it can have only one of the two value :0 and 1

List of Bitwise operators-:-

 Oprators    Meaning

  ~      1’s Complement

  <<      Left shift

  >>     Right shift

  &      Bitwise AND

  |      Bitwise OR

  ^      Bitwise X-OR


Special Operators:-

In C programming language contains many different kinds of operators which may be calssified as special or miscellaneous operators because they do not belong to any specifies category.

List of Special Operators-:-

 Oprators    Meaning

  ,       Comma operator

  *      Pointer operator

  &      Address of operator

  .       Dot operator

  ->     Member Access operator


Unary operators-:-

List of Unary operators-:-

 Oprators    Meaning

  -      Unary minus

  ++      Increment by 1

  --      Decrement by 1

  sizeof()   Returns the size of the operand