C Tutorial

Define C

Define Programming

First C Program

Compiler vs Interpreter

C - Variable

C - Keywords

C - Data Types

C - Comments

Turbo C - Shortcut keys

C - Operators

Hierarchy of Operators

Ex: Arithmetic Operator

C - Formatting Output

Constant Variable

C - Escape Sequence

C - if statement

Ex: If statement

C - Switch statement

Increment / Decrement

C - Loops

Ex: Loops

C - Nesting Of Loops

Ex: Nested Loops

C - Jumping Statements

C - Gotoxy Function

C - Arrays 1D

C - Arrays 2D

C - Sorting

ASCII Value

Character I/O Function

C - String Functions

Ex: Strings

Array of Strings

C - Math Functions

User-defined Function

Exercise Function

Local, Reference variable

Function Calling types

Array Passing Function

Recursion Function

Storage Class

C - Header Files

C - Preprocessor

C - Pointers

C - Structures

C - Typedef

C - Enumeration

C - File Handling

Ex: File Handling

Command Line Argument

MCQ

Question & Answer

Page Stats

Visitor: 942

Hierarchy of operators

The Priority or Precedence is the order in which the operators are to be performed is called the Hierarchy of operators. The associativity specifies the operator's direction to be evaluated, it may be left to right or right to left.

Priority Operator Associativity
(Highest) ( ) left-to-right
++ , -- right-to-left
* , / , % left-to-right
+ , - left-to-right
< , > , <= , >= left-to-right
== , != left-to-right
&& left-to-right
|| left-to-right
(Lowest) = right-to-left

Example 1: Program to explain operator precedence.

#include<stdio.h>
#include<conio.h>

void main()
{
   float r;
   clrscr();
   r = 1.0 + 2.0 * 3.0 / 4.0;
   printf("\n%f",r);
   r = 1.0 / 2.0 + 3.0;
   printf("\n%f",r);
   r = (1.0 + 2.0) / 3.0;
   printf("\n%f",r);
   r = (1.0 + 2.0 / 3.0) + 4.0;
   printf("\n%f",r);
   getch();
}
2.500000
3.500000
1.000000
5.666667