|
C Programming Tutorials
Basics of C:
Facts about C
Why to Use C
C Program File
C Compilers
Program Structure:
Simple C Program
C
Program Compilation
Basic DataTypes:
DataTypes
Modifiers
Qualifiers
Arrays
Variable Types:
Local Variable
Global
Variable
Storage Classes:
auto storage class
register storage
class
static storage
class
extern storage
class
Using Constants:
Defining Constants
The enum Data Types
Operator Types:
Arithmetic Operators
Logical Operators
Bitwise Operators
Assignment Operators
Misc
Operators
Control Statements:
Branching
Looping
Input and Output:
printf() function
scanf() function
Pointing to Data:
Pointers and Arrays
Pointer
Arithmetic
Pointer Arithmetic
with arrays
Functions:
Using functions
Declaration and
Definition
Strings:
Reading and Writing
Strings
String Manipulation Function
Structured DataTypes:
Structure
Pointer to Structure
Working with Files:
Files
Basic I/O
Bits:
Bits Manipulation
Bits Field
Pre-Processors:
Pre-Processors Examples
Parameterized Macros
Macro
Caveats
Useful Concepts
Built-in Library Functions:
String Manipulation
Function
Memory Management
Function
Buffer
Manipulation
Character
Functions
Error Handling
Functions
Soft Skills
Communication Skills
Leadership Skills
.........More
|
|
C Programming Tutorials
Operator Types
What is Operator? Simple answer can be given using expression 4 + 5 is equal to
9. Here 4 and 5 are called operands and + is called operator. C language
supports following type of operators.
Lets have a look on all operators one by one.
Arithmetic Operators:
There are following arithmetic operators supported by C language:
Assume variable A holds 10 and variable holds 20 then:
Show Examples
| Operator |
Description |
Example |
| + |
Adds two operands |
A + B will give 30 |
| - |
Subtracts second operand
from the first |
A - B will give -10 |
| * |
Multiply both operands |
A * B will give 200 |
| / |
Divide numerator by
denominator |
B / A will give 2 |
| % |
Modulus Operator and
remainder of after an integer division |
B % A will give 0 |
| ++ |
Increment operator,
increases integer value by one |
A++ will give 11 |
| -- |
Decrement operator,
decreases integer value by one |
A-- will give 9 |
Logical (or Relational)
Operators:
There are following logical operators supported by C language
Assume variable A holds 10 and variable holds 20 then:
Show Examples
| Operator |
Description |
Example |
| == |
Checks if the value of two
operands is equal or not, if yes then condition becomes true. |
(A == B) is not true. |
| != |
Checks if the value of two
operands is equal or not, if values are not equal then condition becomes
true. |
(A != B) is true. |
| > |
Checks if the value of left
operand is greater than the value of right operand, if yes then
condition becomes true. |
(A > B) is not true. |
| < |
Checks if the value of left
operand is less than the value of right operand, if yes then condition
becomes true. |
(A < B) is true. |
| >= |
Checks if the value of left
operand is greater than or equal to the value of right operand, if yes
then condition becomes true. |
(A >= B) is not true. |
| <= |
Checks if the value of left
operand is less than or equal to the value of right operand, if yes then
condition becomes true. |
(A <= B) is true. |
| && |
Called Logical AND operator.
If both the operands are non zero then then condition becomes true. |
(A && B) is true. |
| || |
Called Logical OR Operator.
If any of the two operands is non zero then then condition becomes true. |
(A || B) is true. |
| ! |
Called Logical NOT Operator.
Use to reverses the logical state of its operand. If a condition is true
then Logical NOT operator will make false. |
!(A && B) is false. |
NEXT >> Bitwise
Operators
Have a Question ?
post your questions here. It
will be answered as soon as possible.
Check
C Aptitude Questions
for more C Aptitude Interview Questions with Answers
Check
C Interview Questions
for more C Interview Questions with Answers
|