Skip to main content

Operators In C Language

About Operator:-

*An operator is a symbol that tells the compiler to perform specific mathematical
or logical functions.
*C language is rich in built-in operators and provides the
  following types of operators:-
1)Arithmetic Operators
2) Relational Operators
3) Logical Operators
4) Bitwise Operators
5) Assignment Operators
6) Misc Operators
 Now We Look All Oprators One By One:-

1)Airthmatic Operators:

The List Of Operators And Their Description
As Well As Example Is Given In Below Table
We Assume Value Of A=10 And B=20
Example Program:-                                                     
#include <stdio.h>
int
main()
{                                                                                  Output Screen :(Kali Linux)
int x = 26;
int y = 13;
int z ,w,v,e,f;
int b;

z = x + y;
printf(" Value of z  is %d\n", z );
w= x - y;
printf(" Value of w is %d\n", w );                       
v = x * y;
printf(" Value of v is %d\n", v );
b = x / y;
printf(" Value of b is %d\n", b );
e = x % y;
printf(" Value of e is %d\n", e );
f= x++;
printf(" Value of f is %d\n", f );
g = y--;
printf(" Value of g is %d\n", g );
return 0;

}2) Relational Operator:-

The List Of Operators And Their Description
As Well As Example Is Given In Below Table:-

Example Program:-
#include <stdio.h>
#define A 4
#define B 5
main()
{
int x = 21;
int y = 10;                                                                 Output Screen (Kali Linux)
int z ;
if( x == y )
printf(" x is equal to y\n" );
else
{
printf(" x is not equal to y\n" );
}
if ( x < y )
printf("x is less than y\n" );
else
{
printf(" x is not less than y\n" );
}
if ( x > y )
printf("x is greater than y\n" );
else
{
printf(" x is not greater than y\n" );
}
if ( A <= B )
printf(" a is either less than or equal to b\n" );
if(B>=A)
{
printf("b is either greater than or equal to a\n" );
}
return 0;
}*in above program we have used #define preprocessor  for defining A and B. If You Know About#define preprocessor goto>>>#define preprocessor

3)Logical Operator:-


 Operators                                Explanation                                                Example
1) &&                      Called Logical AND operator. If both the                (A &&  false.)                                                           operands are non-zero, then the                                                                                                                  condition becomes true.

2) ||                          Called Logical OR Operator. If any of the                (A ||B)is true
                                  two (A || B) is true.operands is non-zero,
                                      then  the condition  becomes true.

3)!                                 Called Logical NOT Operator. It is used to
                                       reverse the logical state of its operand. If a          !(A &&B) is true.
                                     condition is true, then Logical NOT operator
                                                      will make it false.

4)Bitwise operator :-

Bitwise operators work on bits and perform bit-by-bit operation:-
The List Of Operators And Their Description
As Well As Example Is Given In Below Table:-

Assignment Operators:-

The List Of Operators And Their Description
As Well As Example Is Given In Below Table:-

6)Miscellaneous Operator:-

Besides the operators discussed above, there are a few other important
operators including sizeof and ? : supported by the C Language.
The List Of Operators And Their Description
As Well As Example Is Given In Below Table:-

                                              THAT'S ALL ABOUT OPERATORS IN C LANGUAGE
                                                I HOPE YOU WILL LIKE IT AND HELPFUL FOR U
                                                 PLEASE SHARE US ON SOCIAL MEDIA..
                                    -: THANKS FOR VISITING US:-




Comments

Popular posts from this blog

Types Of Function In C Language

In C Language We Categories Function In Four Parts On The Basis Of Their Declaration. 1)No return_type No Argument Function 2)No return_type Having Argument Function 3)Having return_type With No Argument Function 4)Having return_type With Argument Function Now We Will See About These Type One By One With Suitable Examples 1)No return_type No Argument Function:-  Any Function Which Are Not Returning Any Value And We Are Not Passing Any Arguments In Function . General Syntax For Declaration:-   void_function_name(); *In Function Definition We Can Only Use Function_name().it means void is optional in definition when you use windows. Example Program:- We Are Taking An Example Program In Which We are Printing Our Name With the help of function. #include<stdio.h> void name();     //function declaration  int main() { name();  //function calling return 0; } void name() //function definition { Printf("Mantu Pathak"); //You Can give YourName . } The Output Of ...

Types Of Array In C language

Two Dimensional Array :- * It Is The Combination Of Two One Dimensional Array * It Is Used To Implement Matrix Operation . *A two-dimensional array can be considered as a table which  will have 'a' number of rows and'b'number of columns. Declaration Of Two Dimensional Array:-   data_type Array_name [size of row][size of column]; For Example:- int matrix[3][4]; in above example we will store a matrix of 3*3. This Will Cleared From Following Figure:- *It can be represented a[i][j].where i and j represents  row and column respectively. Initialization Of Two Dimensional Array:- let us consider an array "float a[3][3]"then it will be initialized float a[3][3]={                {1.2,2.3,4.3} //initializers for row indexed by 0                {2.1,2.2,2.3} //initializers for row indexed by 1                {3.1,3.4,3.6} //initializers for row indexed by 2 ...

Introduction To "C" Language

Basic Introduction:- Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC PDP-11 computer in 1972. In 1978, Brian Kernighan and Dennis Ritchie produced the first publicly available description of C, now known as the K&R standard. The UNIX operating system, the C compiler, and essentially all UNIX application programs have been written in C. C has now become a widely used professional language for various reasons: 1. Easy to learn 2. Structured language 3. It produces efficient programs 4. It can handle low-level activities 5. It can be compiled on a variety of computer platforms IMPORTENT FACTS ABOUT C:- *) C was invented to write an operating system called UNIX. a) C is a successor of B language which was introduced around the early    1970s. b) The language was formalized in 1988 by the American National Standard    Institute (ANSI). c) The UNIX OS was totally written in C. d) Today C is the most wid...